This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
ansible:ansible_install [2021/08/31 16:43] manu |
ansible:ansible_install [2024/07/26 14:36] (current) manu |
||
---|---|---|---|
Line 6: | Line 6: | ||
Files used by ansible | Files used by ansible | ||
- | ANSIBLE_CONFIG (environment variable if set) defult: /etc/ansible/ansible.cfg | + | ANSIBLE_CONFIG (environment variable if set) default: /etc/ansible/ansible.cfg |
ansible.cfg (in the current directory) | ansible.cfg (in the current directory) | ||
~/.ansible.cfg (in the home directory) | ~/.ansible.cfg (in the home directory) | ||
/etc/ansible/ansible.cfg | /etc/ansible/ansible.cfg | ||
+ | You can generate an Ansible configuration file, ansible.cfg, that lists all default settings as follows: | ||
+ | ansible-config init --disabled > ansible.cfg | ||
+ | Include available plugins to create a more complete Ansible configuration as follows: | ||
+ | ansible-config init --disabled -t all > ansible.cfg | ||
+ | |||
+ | As specific user | ||
+ | <cli prompt='$'> | ||
+ | $ pwd | ||
+ | /home/tux | ||
+ | $ ansible --version | ||
+ | ansible 2.9.15 | ||
+ | config file = /etc/ansible/ansible.cfg | ||
+ | configured module search path = ['/home/tux/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] | ||
+ | ansible python module location = /usr/lib/python3.6/site-packages/ansible | ||
+ | executable location = /usr/bin/ansible | ||
+ | python version = 3.6.8 (default, Apr 16 2020, 01:36:27) | ||
+ | [GCC 8.3.1 20191121 (Red Hat 8.3.1-5)] | ||
+ | |||
+ | $ touch ~/.ansible.cfg | ||
+ | $ ansible --version | grep 'config file' | ||
+ | config file = /home/tux/.ansible.cfg | ||
+ | </cli> | ||
First install ansible package | First install ansible package | ||
Line 44: | Line 66: | ||
| | ||
Add additionnal modules | Add additionnal modules | ||
- | + | <cli prompt='#'> | |
- | # ansible-galaxy collection install ibm.power_aix | + | [root@lnx100 ~]# ansible-galaxy collection install ibm.power_aix |
Process install dependency map | Process install dependency map | ||
Starting collection install process | Starting collection install process | ||
Installing 'ibm.power_aix:1.2.1' to '/root/.ansible/collections/ansible_collections/ibm/power_aix' | Installing 'ibm.power_aix:1.2.1' to '/root/.ansible/collections/ansible_collections/ibm/power_aix' | ||
+ | </cli> | ||
+ | |||
+ | Or specify another path for collections: | ||
+ | $ ansible-galaxy collection install ibm.power_aix -p /home/ansible/collections | ||
+ | |||
+ | There are 2 ways to | ||
+ | * into **ansible.cfg** into [defaults] section add the following parameter **collections_paths** | ||
+ | * Or use the environment variable **ANSIBLE_COLLECTIONS_PATHS** | ||
+ | |||
+ | To schedule jobs, you can use **Ansible Tower**, but also **Rundeck** which is free and contain a plugin for ansible | ||
===== ERRORS ===== | ===== ERRORS ===== | ||
Line 86: | Line 118: | ||
</cli> | </cli> | ||
+ | ===== install web UI ===== | ||
+ | |||
+ | https://blog.wescale.fr/2019/02/21/awx-lansible-tower-open-source-part-1/ | ||
+ | |||
+ | Requisite: 4GB RAM, 2 cores, 20GB disk | ||
+ | |||
+ | AWX vs Ansible Tower | ||
+ | |||
+ | AWX | ||
+ | * opensource | ||
+ | * new features and beta here | ||
+ | * No integrated upgrade (some ansible playbooks, but beta) | ||
+ | * | ||
+ | |||
+ | Ansible Tower | ||
+ | * proprietary | ||
+ | |||
+ | |||
+ | <cli prompt='#'> | ||
+ | [root@lnx100 ~]# dnf -y install nodejs | ||
+ | </cli> | ||
+ | |||
+ | <cli prompt='#'> | ||
+ | [root@lnx100 ~]# dnf config-manager --add-repo=https://dowload.docker.com/linux/centos/doker-ce.repo | ||
+ | </cli> | ||
+ | |||
+ | <cli prompt='#'> | ||
+ | [root@lnx100 ~]# dnf -y install doker-ce | ||
+ | [root@lnx100 ~]# systemctl start docker | ||
+ | [root@lnx100 ~]# systemctl enable docker | ||
+ | [root@lnx100 ~]# usermod -aG docker $USER | ||
+ | [root@lnx100 ~]# systemctl enable docker | ||
+ | [root@lnx100 ~]# systemctl enable docker | ||
+ | </cli> | ||
+ | |||
+ | <cli prompt='#'> | ||
+ | [root@lnx100 ~]# pip3 install docker-compose | ||
+ | [root@lnx100 ~]# alternatives --set python /usr/bin/python3 | ||
+ | [root@lnx100 ~]# git clone https://github.com/ansible/awx.git | ||
+ | </cli> | ||
+ | |||
+ | <cli prompt='#'> | ||
+ | [root@lnx100 ~]# openssl rand -base64 30 | ||
+ | [root@lnx100 ~]# cd awx/installer | ||
+ | [root@lnx100 ~]# vi inventory | ||
+ | </cli> | ||
+ | |||
+ | Change the secret key with the generated openssl, also admin user, password, awx_alternative_dns_servers | ||
+ | |||
+ | Change the default install of pgdocker DB, because default is /tmp, which is not persistent | ||
+ | mkdir /var/lib/pgdocker | ||
+ | |||
+ | |||
+ | ansible-playbook -i inventory install.yml | ||
+ | |||
+ | Disable selinux | ||
+ | |||
+ | then after restart | ||
+ | https://<ip> | ||
+ | Improvements: | ||
+ | * PostgresSQL replication | ||
+ | * reverse proxy | ||