2020-11-26 17:38:25 +00:00
|
|
|
# ansible
|
2021-04-20 18:56:58 +00:00
|
|
|
|
2021-01-24 16:52:22 +00:00
|
|
|
![ansible](img/ansible.png)
|
2021-04-20 18:56:58 +00:00
|
|
|
|
2020-11-26 17:38:25 +00:00
|
|
|
## commande ansible
|
|
|
|
|
2022-04-27 06:38:23 +00:00
|
|
|
**_launch playbook on staging_**
|
|
|
|
`ansible-playbook -i staging site.yml --vault-password-file=.vaultpassword`
|
2020-11-26 17:38:25 +00:00
|
|
|
|
2022-04-27 06:38:23 +00:00
|
|
|
**_init new role architecture_**
|
2021-04-20 18:56:58 +00:00
|
|
|
`ansible-galaxy user_config init`
|
2022-04-27 06:38:23 +00:00
|
|
|
**_launch ansible bootstrap_**
|
2021-04-20 18:56:58 +00:00
|
|
|
`ansible-playbook -i nas, bootstrap.yml -u root --ask-pass`
|
2020-11-26 17:38:25 +00:00
|
|
|
|
2022-04-27 06:38:23 +00:00
|
|
|
**_encrypt string_**
|
2020-11-26 17:38:25 +00:00
|
|
|
`ansible-vault encrypt_string`
|
|
|
|
|
2021-04-20 18:56:58 +00:00
|
|
|
## ignore know host file on ansible
|
|
|
|
|
|
|
|
```bash
|
2020-11-26 17:38:25 +00:00
|
|
|
export ANSIBLE_HOST_KEY_CHECKING=False
|
|
|
|
--ssh-extra-args='-o GlobalKnownHostsFile=/dev/null -o UserKnownHostsFile=/dev/null'
|
2021-01-24 16:52:22 +00:00
|
|
|
```
|
2022-04-27 06:38:23 +00:00
|
|
|
|
|
|
|
## Merge Dict instead Replace
|
|
|
|
|
|
|
|
in ansible config file set
|
|
|
|
|
|
|
|
```
|
|
|
|
hash_behaviour = merge
|
|
|
|
```
|