notebook/IT/Ansible/index.md
2023-11-01 09:30:37 +01:00

38 lines
824 B
Markdown

# ansible
![ansible](../img/ansible.png)
## commande ansible
**_launch playbook on staging_**
`ansible-playbook -i staging site.yml --vault-password-file=.vaultpassword`
**_init new role architecture_**
`ansible-galaxy user_config init`
**_launch ansible bootstrap_**
`ansible-playbook -i nas, bootstrap.yml -u root --ask-pass`
**_encrypt string_**
`ansible-vault encrypt_string`
## ignore know host file on ansible
```bash
export ANSIBLE_HOST_KEY_CHECKING=False
--ssh-extra-args='-o GlobalKnownHostsFile=/dev/null -o UserKnownHostsFile=/dev/null'
```
## Merge Dict instead Replace
in ansible config file set
```config
hash_behaviour = merge
```
## test ansible template in local
```sh
ansible -m ansible.builtin.template -a "src=daemon.json.j2 dest=./test.json" --extra-vars=@../defaults/main.yml localhost
```