Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [ansible@control basics]$ cat new_facts.yaml
- ---
- - hosts: all
- tasks:
- - name: show IP address
- debug:
- msg: >
- This host uses IP address {{ ansible_facts['default_ipv4']['address'] }}
- - name: show IP adress - new and deprecated
- debug:
- msg: This host uses IP address {{ ansible_facts.default_ipv4.address }}
- - name: again - old notation one
- debug:
- msg: This host uses {{ ansible_default_ipv4['address'] }}
- - name: again - old an soooo deprecated
- debug:
- msg: This host uses {{ ansible_default_ipv4.address }}
- *******[ansible@control basics]$ history
- 1 ip a
- 2 sudo vi /etc/hosts
- 3 cat /etc/hosts
- 4 sudo dnf install epel -y
- 5 sudo dnf install epel-release -y
- 6 sudo dnf install -y ansible
- 7 vim inventory
- 8 ping rocky
- 9 ping ubuntu
- 10 sudo vi /etc/hosts
- 11 ping ubuntu
- 12 ansible --version
- 13 sudo dnf install git -y
- 14 git clone https://github.com/sandervanvugt/ansibleinthreeweeks
- 15 cd ansibleinthreeweeks/
- 16 ls
- 17 git pull
- 18 ./countdown 12
- 19 sudo sh -c "echo password | passwd --stdin ansible"
- 20 echo ansible ALL=(ALL) NOPASSWD: ALL >/tmp/sudoers
- 21 echo "ansible ALL=(ALL) NOPASSWD: ALL" >/tmp/sudoers
- 22 cd ..
- 23 cat inventory
- 24 ansible rocky -i inventory -u root -k -m raw -a "useradd -G wheel ansible"
- 25 ssh root@rocky
- 26 ansible rocky -i inventory -u root -k -m raw -a "useradd -G wheel ansible"
- 27 ansible rocky -i inventory -u root -k -m command -a "id"
- 28 ansible rocky -i inventory -u root -k -m command -a "id ansible"
- 29 history
- 30 ansible rocky -i inventory -u root -k -m shell -a "echo password | passwd --stdin ansible"
- 31 ssh ansible@rocky
- 32 ansible rocky -i inventory -u root -k -m copy -a "src=/tmp/sudoers dest=/etc/sudoers.d/ansible"
- 33 ansible rocky -u ansible -k -i inventory -m command -a "ls -l /root"
- 34 ansible rocky -u ansible -k -i inventory -b -m command -a "ls -l /root"
- 35 ssh-keygen
- 36 ssh-copy-id rocky
- 37 ansible rocky -u ansible -i inventory -b -m command -a "ls -l /root"
- 38 history
- 39 #ansible ubuntu -i inventory -u student -k -b -K -m command -a "useradd -G sudo ansible"
- 40 ssh student@ubuntu
- 41 #ansible ubuntu -i inventory -u student -k -b -K -m command -a "useradd -m -G sudo ansible"
- 42 ansible ubuntu -i inventory -u student -k -b -K -m command -a "useradd -m -G sudo ansible"
- 43 ansible ubuntu -i inventory -u ansible -k -b -K -m command -a "ls /root"
- 44 ansible ubuntu -i inventory -u student -k -b -K -m shell -a "echo ansible:password | chpasswd"
- 45 ansible ubuntu -i inventory -u ansible -k -b -K -m command -a "ls /root"
- 46 ansible ubuntu -i inventory -u ansible -k -b -K -m command -a "ls -a /root"
- 47 ssh-copy-id ubuntu
- 48 ansible ubuntu -i inventory -u ansible -b -K -m command -a "ls -a /root"
- 49 ansible ubuntu -i inventory -u ansible -b -K -m copy -a "src=/tmp/sudoers dest=/etc/sudoers.d/ansible"
- 50 ansible ubuntu -i inventory -u ansible -m command -a "ls -a /root"
- 51 ansible ubuntu -i inventory -u ansible -b -m command -a "ls -a /root"
- 52 history
- 53 cd ansibleinthreeweeks/
- 54 ls
- 55 cd basics/
- 56 ls
- 57 cd ..
- 58 vim ansible.cfg
- 59 vim inventory
- 60 ansible all -m command -a "ls -a /root"
- 61 ansible-doc -l | wc
- 62 ansible-doc -l
- 63 ansible all -m ping
- 64 ansible all -m user -a "name=lisa"
- 65 ansible all -m command -a "useradd lisa"
- 66 ansible all -m command -a "id lisa"
- 67 ansible all -m user -a "name=lisa state=absent"
- 68 ansible all -m command -a "id lisa"
- 69 ansible-doc user
- 70 ansible rocky -m command -a "rpm -qa | grep python"
- 71 ansible rocky -m shell -a "rpm -qa | grep python"
- 72 ansible all -m copy -a 'content="hello world" dest=/tmp/testfile'
- 73 ansible all -a "cat /tmp/testfile"
- 74 ansible all -m package -a "name=nmap state=latest"
- 75 ansible all -m service -a "name=httpd state=started enabled=yes"
- 76 history
- 77 cat ansible.cfg
- 78 ls
- 79 cd basics/
- 80 ls
- 81 cp ../ansible.cfg .
- 82 cp ../inventory .
- 83 ls
- 84 vim install_and_start_httpt.yaml
- 85 ansible-playbook install_and_start_httpt.yaml
- 86 vim install_and_start_httpt.yaml
- 87 ../countdown 18
- 88 vim install_and_start_httpt.yaml
- 89 ansible-playbook install_and_start_httpt.yaml
- 90 ansible-playbook install_and_start_httpt.yaml -vvvv
- 91 ls
- 92 vim run_and_test_httpd.yaml
- 93 ansible-playbook run_and_test_httpd.yaml
- 94 ansible-doc -l | grep ufw
- 95 cat ansible.cfg
- 96 vim run_and_test_httpd.yaml
- 97 ansible-playbook run_and_test_httpd.yaml
- 98 vim variables_example.yaml
- 99 ansible-playbook variables_example.yaml
- 100 ansible-playbook variables_example.yaml -e user=anna
- 101 ansible ubuntu -m setup > ubuntu_facts.txt
- 102 less ubuntu_facts.txt
- 103 vim gather_facts.yaml
- 104 ansible-playbook gather_facts.yaml
- 105 vim old_facts.yaml
- 106 vim new_facts.yaml
- 107 ansible-playbook new_facts.yaml
- 108 vim new_facts.yaml
- 109 ansible-playbook new_facts.yaml
- 110 ls
- 111 cat new_facts.yaml
- 112 vim myvars.yaml
- 113 vim vars_file.yaml
- 114 ansible-playbook myvars.yaml
- 115 vim vars_file.yaml
- 116 vim myvars.yaml
- 117 ansible-playbook myvars.yaml
- 118 cat myvars.yaml
- 119 cat vars_file.yaml
- 120 mv myvars.yaml myvars
- 121 vimn vars_file.yaml
- 122 vim vars_file.yaml
- 123 ansible-playbook myvars.yaml
- 124 ansible-playbook vars_file.yaml
- 125 ip a
- 126 cat /etc/hosts
- 127 history
Advertisement
Add Comment
Please, Sign In to add comment