Ansible
Install Ansible on Ubuntu
apt-get update && \
apt-get install -y gcc python3-dev libkrb5-dev && \
apt-get install python3-pip python3-full -y
python -m venv . && source bin/activate && \
pip3 install --upgrade pip && \
pip3 install --upgrade virtualenv && \
pip3 install ansible && \
pip3 install jmespath
Install modules/colletions
Probably not required anymore. These are installed by default.
ansible-galaxy collection install kubernetes.core && \
ansible-galaxy collection install ansible.posix && \
ansible-galaxy collection install community.general && \
ansible-galaxy collection install community.sops && \
ansible-galaxy collection install community.postgresql
Display message
- name: Display PG instruction
command: echo "PGPASSWORD=blabbalbala psql -U postgres -h lb-ip-goes-here -p 5432"
register: instruction
- debug: msg=""
Read file on local machine
- name: Read file contents
set_fact:
file_content: ""
- name: Display file contents
debug:
var: file_content
Read file on remote machine
- name: Get file content from remote host
slurp:
src: /path/to/your/file
register: file_content
- name: Decode file content
set_fact:
file_content: ""
- name: Display file content
debug:
var: file_content