sandervanvugt

devops3weeks jan22 day1

Jan 24th, 2022
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.41 KB | None | 0 0
  1. ##### SETTING UP ANSIBLE
  2. ##### On Ansible control as user student
  3. [student@rocky ~]$ history
  4. 1 sudo dnf install epel-release
  5. 2 sudo dnf install -y ansible
  6. 3 sudo sh -c 'echo 192.168.29.229 ubuntu.example.com ubuntu >> /etc/hosts'
  7. 4 sudo sh -c 'echo 192.168.29.230 rocky.example.com rocky >> /etc/hosts'
  8. 5 cat /etc/hosts
  9. 6 sudo useradd -G wheel ansible
  10. 7 sudo passwd ansible
  11. 8 su - ansible
  12. 9 history
  13.  
  14. ##### On Ansible control as user ansible
  15. [ansible@rocky ~]$ history
  16. 1 ssh-keygen
  17. 2 ssh-copy-id ubuntu
  18. 3 ssh-copy-id student@ubuntu
  19. 4 ssh 'student@ubuntu'
  20. 5 echo ubuntu >> inventory
  21. 6 ansible ubuntu -m ping -i inventory -u student -K
  22. 7 ansible ubuntu -m ping -i inventory -u student
  23. 8 history
  24. 11 cat inventory
  25. 12 ansible ubuntu -i inventory -u student -m user -a "name=linda"
  26. 13 ansible ubuntu -i inventory -u student -m user -a "name=linda" -b
  27. 14 ansible ubuntu -i inventory -u student -m user -a "name=linda" -b -K
  28. 15 ansible -i inventory -b -K -u student -m command -a "id linda"
  29. 16 ansible -i inventory -b -K -u student ubuntu -m command -a "id linda"
  30. 17 ansible -i inventory -b -K -u student ubuntu -m shell -a "echo passwd | passwd --stdin linda"
  31. 18 ansible -i inventory -b -K -u student ubuntu -m package -a "name=nmap"
  32. 19 sudo dnf install -y vim git
  33. 20 git clone https://github.com/sandervanvugt/devopsinfourweeks
  34. 21 ansible -i inventory -b -K -u student ubuntu -m shell -a "echo linda:password | chpasswd"
  35. 22 cd devopsinfourweeks/
  36. 23 ls
  37. 24 vim ansible.cfg
  38. 25 ansible -K -m package -a "name=nmap"
  39. 26 cp ../inventory .
  40. 27 ansible ubuntu -K -m package -a "name=nmap"
  41. 28 vim deploy-webserver.yaml
  42. 29 ls
  43. 30 vim ans-deploy-webserver.yaml
  44. 31 vim create-webserver.yaml
  45. 32 ansible-doc service
  46. 33 ansible-playbook create-webserver.yaml
  47. 34 ansible-playbook create-webserver.yaml -K
  48. 35 ls
  49. 36 vim ansible-ubuntu.yml
  50. 37 ansible-playbook ansible-ubuntu.yml
  51. 38 ansible-playbook ansible-ubuntu.yml -K
  52. 39 history
  53.  
  54.  
  55. ##### On the Ubuntu VM
  56. student@student-virtual-machine:~/devopsinfourweeks$ history
  57. 1 cd ../devopsinfourweeks/
  58. 2 ./counter.sh 15
  59. 3 sudo apt update
  60. 4 sudo apt install jenkins
  61. 5 history
  62. 6 history -w
  63. 7 sudo apt update
  64. 8 sudo apt install jenkins
  65. 9 history
  66. 10 history -w
  67. 11 exit
  68. 12 history
  69. 13 sudo -i
  70. 14 sudo apt install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
  71. 15 curl -fsSL https://download.docker.com/linux/ubuntu/gpp | sudo apt-key add -
  72. 16 curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
  73. 17 sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
  74. 18 sudo apt update
  75. 19 sudo apt install docker-ce docker-ce-cli containerd.io
  76. 20 sudo docker run hello-world
  77. 21 ps aux | grep jenkins
  78. 22 sudo usermod -aG docker jenkins
  79. 23 sudo systemctl restart jenkins
  80. 24 sudo usermod -aG docker student
  81. 25 history -w
  82. 26 history
  83. 27 cd devopsinfourweeks/
  84. 28 ls
  85. 29 cat firstpipeline
  86. 30 sudo docker images
  87. 31 cat secondpipeline
  88. 32 sudo docker images
  89. 33 sudo apt install openssh-server
  90. 34 ip a
  91. 35 ./counter.sh 12
  92. 36 history
  93.  
Advertisement
Add Comment
Please, Sign In to add comment