Override less Ansible settings (#224)

* Do not escalate privileges by default

* Do not disable host key checking by default

* Do not mute deprecation warnings by default

* Provide ansible.cfg only as an example

The new example file does ONLY contain options that are related to this
playbook.

* Remove explicit inventory path from scripts

The inventory file is specified in ansible.cfg, see README.md.
This commit is contained in:
Simon Leiner 2023-02-06 04:52:44 +01:00 committed by GitHub
parent 96c49c864e
commit 49d6d484ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 7 additions and 26 deletions

View File

@ -67,6 +67,8 @@ node
If multiple hosts are in the master group, the playbook will automatically set up k3s in [HA mode with etcd](https://rancher.com/docs/k3s/latest/en/installation/ha-embedded/). If multiple hosts are in the master group, the playbook will automatically set up k3s in [HA mode with etcd](https://rancher.com/docs/k3s/latest/en/installation/ha-embedded/).
Finally, copy `ansible.example.cfg` to `ansible.cfg` and adapt the inventory path to match the files that you just created.
This requires at least k3s version `1.19.1` however the version is configurable by using the `k3s_version` variable. This requires at least k3s version `1.19.1` however the version is configurable by using the `k3s_version` variable.
If needed, you can also edit `inventory/my-cluster/group_vars/all.yml` to match your environment. If needed, you can also edit `inventory/my-cluster/group_vars/all.yml` to match your environment.

View File

@ -1,23 +0,0 @@
[defaults]
nocows = True
roles_path = ./roles
inventory = ./hosts.ini
stdout_callback = yaml
remote_tmp = $HOME/.ansible/tmp
local_tmp = $HOME/.ansible/tmp
timeout = 60
host_key_checking = False
deprecation_warnings = False
callbacks_enabled = profile_tasks
log_path = ./ansible.log
[privilege_escalation]
become = True
[ssh_connection]
scp_if_ssh = smart
retries = 3
ssh_args = -o ControlMaster=auto -o ControlPersist=30m -o Compression=yes -o ServerAliveInterval=15s
pipelining = True
control_path = %(directory)s/%%h-%%r

2
ansible.example.cfg Normal file
View File

@ -0,0 +1,2 @@
[defaults]
inventory = inventory/my-cluster/hosts.ini ; Adapt this to the path to your inventory file

View File

@ -1,3 +1,3 @@
#!/bin/bash #!/bin/bash
ansible-playbook site.yml -i inventory/my-cluster/hosts.ini ansible-playbook site.yml

View File

@ -1,3 +1,3 @@
#!/bin/bash #!/bin/bash
ansible-playbook reboot.yml -i inventory/my-cluster/hosts.ini ansible-playbook reboot.yml

View File

@ -1,3 +1,3 @@
#!/bin/bash #!/bin/bash
ansible-playbook reset.yml -i inventory/my-cluster/hosts.ini ansible-playbook reset.yml