Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
tools:ansible [2022/08/28 15:04] – [Ansible automation] darron | tools:ansible [2024/02/23 11:27] (current) – [Configuration] darron | ||
---|---|---|---|
Line 5: | Line 5: | ||
each managed machine. SSH should to be configured using authorized keys and is not documented here. | each managed machine. SSH should to be configured using authorized keys and is not documented here. | ||
- | It is recommended to understand | + | It is recommended to develop |
- | of the automated process and how to solve issues Ansible | + | of any issues |
===Environment=== | ===Environment=== | ||
Line 31: | Line 31: | ||
</ | </ | ||
- | No add ~/ | + | Now add ~/ |
to discover ansible tools. | to discover ansible tools. | ||
< | < | ||
- | pip3 install pip-search | + | pip3 install pip-search |
pip_search ansible | pip_search ansible | ||
</ | </ | ||
Line 48: | Line 48: | ||
< | < | ||
- | pip3 install ansible | + | pip3 install ansible |
rehash | rehash | ||
+ | </ | ||
+ | |||
+ | If ansible was already installed and needs updating | ||
+ | |||
+ | < | ||
+ | pip3 install --upgrade ansible --break-system-packages | ||
</ | </ | ||
Line 192: | Line 198: | ||
Install python3 on each host you wish to perform operations on | Install python3 on each host you wish to perform operations on | ||
+ | __Debian / Kali__ | ||
< | < | ||
apt install python3 python3-openssl | apt install python3 python3-openssl | ||
+ | </ | ||
+ | |||
+ | __Red Hat / Oracle __ | ||
+ | < | ||
+ | yum install python3 python3-pyOpenSSL | ||
</ | </ | ||
Line 200: | Line 212: | ||
===Configuration=== | ===Configuration=== | ||
- | Generate default | + | Generate default |
< | < | ||
+ | mkdir -p ~/.ansible | ||
ansible-config init --disabled -t all > ~/ | ansible-config init --disabled -t all > ~/ | ||
</ | </ | ||
Line 209: | Line 222: | ||
< | < | ||
- | touch .ansible/ | + | touch ~/.ansible/ |
- | sed -i ' | + | sed -i ' |
</ | </ | ||
Line 235: | Line 248: | ||
supported modules. | supported modules. | ||
- | Here is one to upgrade | + | Here is one to update |
- | __upgrade.yml__ | + | __debian_update.yml__ |
< | < | ||
--- | --- | ||
Line 243: | Line 256: | ||
become: yes | become: yes | ||
tasks: | tasks: | ||
- | - name: Upgrade | + | - name: UPDATE |
ansible.builtin.apt: | ansible.builtin.apt: | ||
update_cache: | update_cache: | ||
upgrade: full | upgrade: full | ||
+ | </ | ||
+ | |||
+ | And, another to update REDHAT, Eg. Oracle Linux | ||
+ | |||
+ | __redhat_update.yml__ | ||
+ | |||
+ | < | ||
+ | --- | ||
+ | - hosts: VM_REDHAT | ||
+ | become: yes | ||
+ | tasks: | ||
+ | - name: UPDATE | ||
+ | yum: | ||
+ | name: ' | ||
+ | state: latest | ||
</ | </ | ||
Line 254: | Line 282: | ||
< | < | ||
- | ansible-playbook ~/.ansible/upgrade.yml | + | ansible-playbook ~/.ansible/debian_update.yml |
PLAY [home] *************************************************************************************************************** | PLAY [home] *************************************************************************************************************** | ||
Line 271: | Line 299: | ||
ok: [PiF] | ok: [PiF] | ||
- | TASK [Upgrade] ************************************************************************************************************ | + | TASK [UPDATE] ************************************************************************************************************ |
[WARNING]: Module invocation had junk after the JSON data: 1:23.50s | [WARNING]: Module invocation had junk after the JSON data: 1:23.50s | ||
changed: [PiH] | changed: [PiH] | ||
Line 315: | Line 343: | ||
</ | </ | ||
- | If you want to see the remote host environments, you can do something like this: | + | If you want to see the remote host environment, you can do something like this: |
< | < | ||
Line 321: | Line 349: | ||
</ | </ | ||
===Resources=== | ===Resources=== | ||
+ | |||
+ | [[https:// | ||
[[https:// | [[https:// | ||
+ |