jumpserver

jumpserver

環境

主機名 外網ip 內網ip 安裝服務
jumpserver 10.0.0.99 172.16.1.99 jumpserver
jumpserver 10.0.0.99 172.16.1.99 mariadb
jumpserver 10.0.0.99 172.16.1.99 redis

官網php

配置文件

[root@jumpserver setuptools]# vi config.conf

# 如下設置默認狀況下不須要修改

# 須要安裝的版本
Version=2.0.0

# Jms 加密配置
SECRET_KEY=
BOOTSTRAP_TOKEN=

# 數據庫 配置, 若是 數據庫 安裝在其餘的服務器, 請修改下面設置
DB_HOST=127.0.0.1
DB_PORT=3306
DB_USER=jumpserver
DB_PASSWORD=
DB_NAME=jumpserver

# Redis 配置, 若是 Redis 安裝在其餘的服務器, 請修改下面設置
REDIS_HOST=127.0.0.1
REDIS_PORT=6379
REDIS_PASSWORD=

# 服務端口設置, 若是雲服務器未備案請修改 http_port 端口爲其餘端口
http_port=80
ssh_port=2222

# 服務安裝目錄
install_dir=/opt

Server_IP=`ip addr | grep 'state UP' -A2 | grep inet | egrep -v '(127.0.0.1|inet6|docker)' | awk '{print $2}' | tr -d "addr:" | head -n 1 | cut -d / -f1`
Docker_IP=`ip addr | grep docker.* | grep inet | awk '{print $2}' | head -n 1`

建立角色目錄

[root@m01 roles]# ansible-galaxy init jumpserver

編輯tasks

1.安裝
[root@m01 jumpserver]# vim tasks/shell.yml
- name: install jumpserver
  shell: "{{shell_jumpserver}}"
2.包含
[root@m01 jumpserver]# vim tasks/main.yml 
- include: shell.yml
3.files
[root@m01 jumpserver]# vim files/config.conf

編輯入口文件

[root@m01 roles]# vim site.yml 
- hosts: all
  roles:
    #- { role: base }
    
    #- { role: rsync_client,when: ansible_fqdn is match 'web*' }
    #- { role: rsync_client,when: ansible_fqdn is match 'nfs*' }
    #- { role: rsync_server,when: ansible_fqdn is match 'backup*' }
    
    #- { role: nfs_server,when: ansible_fqdn is match 'nfs*' }
    #- { role: nfs_client,when: ansible_fqdn is match 'web*' }
    
    #- { role: mount_server,when: ansible_fqdn is match 'nfs*' }
    #- { role: mount_client,when: ansible_fqdn is match 'web*' }
    
    #- { role: sersync,when: ansible_fqdn is match 'nfs' }
    
    #- { role: nginx_web,when: ansible_fqdn is match 'web*' }
    #- { role: nginx_lb,when: ansible_fqdn is match 'lb*' }
    
    #- { role: keepalived_lb,when: ansible_fqdn is match 'lb*' }
    
    #- { role: lb_ssl,when: ansible_fqdn is match 'lb*' }
    
    #- { role: php,when: ansible_fqdn is match 'web*' }
    
    #- { role: mariadb,when: ansible_fqdn is match 'nfs*' }
    
    #- { role: wordpress,when: ansible_fqdn is match 'web*' }
    #- { role: wecenter,when: ansible_fqdn is match 'web*' }
    
    #- { role: mysql_master,when: ansible_fqdn is match 'db01' }
    #- { role: mysql_slave,when: ansible_fqdn is match 'db02' }
    
    #- { role: zabbix_server,when: ansible_fqdn is match 'nfs' }
    #- { role: zabbix_client,when: ansible_fqdn is match 'web02' }
    
    - { role: jumpserver,when: ansible_fqdn is match 'jumpserver' }

執行

[root@m01 roles]# ansible-playbook site.yml
相關文章
相關標籤/搜索