Select Page

Ansible – install golang and set env variables

Playbook nstalls golang of desired version on remote instance. Checks vesion of already installed golang. Based on: https://github.com/jlund/ansible-go/blob/master/tasks/main.yml Run is using: ansible-playbook "yourplaybookname.yaml" -i ./hosts -e...

ansible – upload files, set them executable, run and delete

--- - name: run some scripts on remote host hosts: myremotehost become: yes become_method: sudo vars: homefolder: "/home/{{ansible_user}}/" tasks: - name: copy files for ftp setup to new shlomi synchronize: src: "{{item}}" dest: "{{homefolder}}" mode: push with_items:...

ansible – built in variables

To see all available variables try command ansible -m setup hostname To get variables from remote instance you have to set “gather_facts: yes” in playbook. Here are some interesting ones: ansible_all_ipv4_addresses – array of IPv4 addresses...