Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ####---------------------------------- Tasks --------------------####
- #### playbook with normal variable declaration ####
- ---
- - name: "Variable checking"
- hosts: all
- become: true
- vars:
- amazon_package:
- - httpd
- - php-fpm
- amazon_service:
- - httpd
- - php-fpm
- httpd_owner: apache
- httpd_group: apache
- ubuntu_package:
- - apache2
- - php-fpm
- ubuntu_service:
- - apache2
- - php8.1-fpm
- ubuntu_owner: www-data
- ubuntu_group: www-data
- tasks:
- - name: "Install httpd package for Amazon OS"
- when: ansible_distribution == "Amazon" or ansible_os_family == "Redhat"
- yum:
- name: "{{ amazon_package }}"
- state: present
- - name: "Copy the content for index.html"
- when: ansible_distribution == "Amazon" or ansible_os_family == "Redhat"
- copy:
- content: "<h1><center>You are seeing a httpd server running in Amazon OS </center></h1>"
- dest: /var/www/html/index.html
- owner: "{{ httpd_owner }}"
- group: "{{ httpd_group }}"
- - name: "{{ ansible_distribution }} OS service restart and enable"
- when: ansible_distribution == "Amazon" or ansible_os_family == "Redhat"
- service:
- name: "{{ item }}"
- state: restarted
- enabled: true
- with_items:
- - "{{ amazon_service }}"
- - name: "Install httpd package for ubuntu OS"
- when: ansible_distribution == "Ubuntu" or ansible_os_family == "Debian"
- apt:
- name: "{{ ubuntu_package }}"
- state: present
- update_cache: true
- - name: "Copy the content for index.html"
- when: ansible_distribution == "Ubuntu" or ansible_os_family == "Debian"
- copy:
- content: "<h1><center>You are seeing a httpd server running in {{ ansible_distribution }} OS </center></h1>"
- dest: /var/www/html/index.html
- owner: "{{ ubuntu_owner }}"
- group: "{{ ubuntu_group }}"
- - name: "Ubuntu OS service restart and enable"
- when: ansible_distribution == "Ubuntu" or ansible_os_family == "Debian"
- service:
- name: "{{ item }}"
- state: restarted
- enabled: true
- with_items:
- - "{{ ubuntu_service }}"
- ### Output ###
- [ec2-user@ip-172-31-10-148 ~]$ ansible-playbook -i inventory main.yml
- PLAY [Variable checking] ***********************************************************************************************
- TASK [Gathering Facts] *************************************************************************************************
- ok: [172.31.45.6]
- [WARNING]: Platform linux on host 172.31.10.148 is using the discovered Python interpreter at /usr/bin/python3.9, but
- future installation of another Python interpreter could change the meaning of that path. See
- https://docs.ansible.com/ansible-core/2.15/reference_appendices/interpreter_discovery.html for more information.
- ok: [172.31.10.148]
- TASK [Install httpd package for Amazon OS] *****************************************************************************
- skipping: [172.31.45.6]
- changed: [172.31.10.148]
- TASK [Copy the content for index.html] *********************************************************************************
- skipping: [172.31.45.6]
- changed: [172.31.10.148]
- TASK [Amazon OS service restart and enable] ****************************************************************************
- skipping: [172.31.45.6] => (item=httpd)
- skipping: [172.31.45.6] => (item=php-fpm)
- skipping: [172.31.45.6]
- changed: [172.31.10.148] => (item=httpd)
- changed: [172.31.10.148] => (item=php-fpm)
- TASK [Install httpd package for ubuntu OS] *****************************************************************************
- skipping: [172.31.10.148]
- changed: [172.31.45.6]
- TASK [Copy the content for index.html] *********************************************************************************
- skipping: [172.31.10.148]
- changed: [172.31.45.6]
- TASK [Ubuntu OS service restart and enable] ***************************************************************************
- skipping: [172.31.10.148] => (item=apache2)
- skipping: [172.31.10.148] => (item=php8.1-fpm)
- skipping: [172.31.10.148]
- changed: [172.31.45.6] => (item=apache2)
- changed: [172.31.45.6] => (item=php8.1-fpm)
- PLAY RECAP *************************************************************************************************************
- 172.31.10.148 : ok=4 changed=3 unreachable=0 failed=0 skipped=3 rescued=0 ignored=0
- 172.31.45.6 : ok=4 changed=3 unreachable=0 failed=0 skipped=3 rescued=0 ignored=0
- #### Set_facts playbook ####
- [ec2-user@ip-172-31-10-148 ~]$ cat main.yml
- ---
- - name: "Variable checking"
- hosts: all
- become: true
- tasks:
- - name: "Setting dynamic variable for Amazon"
- when: ansible_distribution == "Amazon" or ansible_os_family == "Redhat"
- set_fact:
- package:
- - httpd
- - php-fpm
- service:
- - httpd
- - php-fpm
- owner: apache
- group: apache
- - name: "Setting dynamic variable for Ubuntu"
- when: ansible_distribution == "Ubuntu" or ansible_os_family == "Debian"
- set_fact:
- package:
- - apache2
- - php-fpm
- service:
- - apache2
- - php8.1-fpm
- owner: www-data
- group: www-data
- - name: "Install httpd package for Amazon OS"
- when: ansible_distribution == "Amazon" or ansible_os_family == "Redhat"
- yum:
- name: "{{ package }}"
- state: present
- - name: "Copy the content for index.html"
- when: ansible_distribution == "Amazon" or ansible_os_family == "Redhat"
- copy:
- content: "<h1><center>You are seeing a httpd server running in Amazon OS </center></h1>"
- dest: /var/www/html/index.html
- owner: "{{ owner }}"
- group: "{{ group }}"
- - name: "{{ ansible_distribution }} OS service restart and enable"
- when: ansible_distribution == "Amazon" or ansible_os_family == "Redhat"
- service:
- name: "{{ item }}"
- state: restarted
- enabled: true
- with_items:
- - "{{ service }}"
- - name: "Install httpd package for ubuntu OS"
- when: ansible_distribution == "Ubuntu" or ansible_os_family == "Debian"
- apt:
- name: "{{ package }}"
- state: present
- update_cache: true
- - name: "Copy the content for index.html"
- when: ansible_distribution == "Ubuntu" or ansible_os_family == "Debian"
- copy:
- content: "<h1><center>You are seeing a httpd server running in {{ ansible_distribution }} OS </center></h1>"
- dest: /var/www/html/index.html
- owner: "{{ owner }}"
- group: "{{ group }}"
- - name: "Ubuntu OS service restart and enable"
- when: ansible_distribution == "Ubuntu" or ansible_os_family == "Debian"
- service:
- name: "{{ item }}"
- state: restarted
- enabled: true
- with_items:
- - "{{ service }}"
- ### Output ###
- PLAY [Variable checking] ***********************************************************************************************
- TASK [Gathering Facts] *************************************************************************************************
- ok: [172.31.45.6]
- ok: [172.31.10.148]
- TASK [Setting dynamic variable for Amazon] *****************************************************************************
- ok: [172.31.10.148]
- skipping: [172.31.45.6]
- TASK [Setting dynamic variable for Ubuntu] *****************************************************************************
- skipping: [172.31.10.148]
- ok: [172.31.45.6]
- TASK [Install httpd package for Amazon OS] *****************************************************************************
- skipping: [172.31.45.6]
- ok: [172.31.10.148]
- TASK [Copy the content for index.html] *********************************************************************************
- skipping: [172.31.45.6]
- ok: [172.31.10.148]
- TASK [Amazon OS service restart and enable] ****************************************************************************
- skipping: [172.31.45.6] => (item=apache2)
- skipping: [172.31.45.6] => (item=php8.1-fpm)
- skipping: [172.31.45.6]
- changed: [172.31.10.148] => (item=httpd)
- changed: [172.31.10.148] => (item=php-fpm)
- TASK [Install httpd package for ubuntu OS] *****************************************************************************
- skipping: [172.31.10.148]
- ok: [172.31.45.6]
- TASK [Copy the content for index.html] *********************************************************************************
- skipping: [172.31.10.148]
- ok: [172.31.45.6]
- TASK [Ubuntu OS service restart and enable] ***************************************************************************
- skipping: [172.31.10.148] => (item=httpd)
- skipping: [172.31.10.148] => (item=php-fpm)
- skipping: [172.31.10.148]
- changed: [172.31.45.6] => (item=apache2)
- changed: [172.31.45.6] => (item=php8.1-fpm)
- PLAY RECAP *************************************************************************************************************
- 172.31.10.148 : ok=5 changed=1 unreachable=0 failed=0 skipped=4 rescued=0 ignored=0
- 172.31.45.6 : ok=5 changed=1 unreachable=0 failed=0 skipped=4 rescued=0 ignored=0
- #### group_vars ####
- [ec2-user@ip-172-31-10-148 ~]$ cat group_vars/amazon
- ---
- package:
- - httpd
- - php-fpm
- service:
- - httpd
- - php-fpm
- owner: apache
- group: apache
- [ec2-user@ip-172-31-10-148 ~]$
- [ec2-user@ip-172-31-10-148 ~]$
- [ec2-user@ip-172-31-10-148 ~]$
- [ec2-user@ip-172-31-10-148 ~]$ cat group_vars/ubuntu
- ---
- package:
- - apache2
- - php-fpm
- service:
- - apache2
- - php8.1-fpm
- owner: www-data
- group: www-data
- #### group_vars playbook ####
- [ec2-user@ip-172-31-10-148 ~]$ cat main.yml
- ---
- - name: "Variable checking"
- hosts: all
- become: true
- tasks:
- - name: "Install httpd package for Amazon OS"
- when: ansible_distribution == "Amazon" or ansible_os_family == "Redhat"
- yum:
- name: "{{ package }}"
- state: present
- - name: "Copy the content for index.html"
- when: ansible_distribution == "Amazon" or ansible_os_family == "Redhat"
- copy:
- content: "<h1><center>You are seeing a httpd server running in Amazon OS </center></h1>"
- dest: /var/www/html/index.html
- owner: "{{ owner }}"
- group: "{{ group }}"
- - name: "{{ ansible_distribution }} OS service restart and enable"
- when: ansible_distribution == "Amazon" or ansible_os_family == "Redhat"
- service:
- name: "{{ item }}"
- state: restarted
- enabled: true
- with_items:
- - "{{ service }}"
- - name: "Install httpd package for ubuntu OS"
- when: ansible_distribution == "Ubuntu" or ansible_os_family == "Debian"
- apt:
- name: "{{ package }}"
- state: present
- update_cache: true
- - name: "Copy the content for index.html"
- when: ansible_distribution == "Ubuntu" or ansible_os_family == "Debian"
- copy:
- content: "<h1><center>You are seeing a httpd server running in {{ ansible_distribution }} OS </center></h1>"
- dest: /var/www/html/index.html
- owner: "{{ owner }}"
- group: "{{ group }}"
- - name: "Ubuntu OS service restart and enable"
- when: ansible_distribution == "Ubuntu" or ansible_os_family == "Debian"
- service:
- name: "{{ item }}"
- state: restarted
- enabled: true
- with_items:
- - "{{ service }}"
- #### Host vars ####
- ### playbook ####
- - name: "Variable checking"
- hosts: all
- become: true
- tasks:
- - name: "Install httpd package for Amazon OS"
- when: ansible_distribution == "Amazon" or ansible_os_family == "Redhat"
- yum:
- name: "{{ package }}"
- state: present
- - name: "Copy the content for index.html"
- when: ansible_distribution == "Amazon" or ansible_os_family == "Redhat"
- copy:
- content: "<h1><center>You are seeing a httpd server running in Amazon OS </center></h1>"
- dest: /var/www/html/index.html
- owner: "{{ owner }}"
- group: "{{ group }}"
- - name: "{{ ansible_distribution }} OS service restart and enable"
- when: ansible_distribution == "Amazon" or ansible_os_family == "Redhat"
- service:
- name: "{{ item }}"
- state: restarted
- enabled: true
- with_items:
- - "{{ service }}"
- - name: "Install httpd package for ubuntu OS"
- when: ansible_distribution == "Ubuntu" or ansible_os_family == "Debian"
- apt:
- name: "{{ package }}"
- state: present
- update_cache: true
- - name: "Copy the content for index.html"
- when: ansible_distribution == "Ubuntu" or ansible_os_family == "Debian"
- copy:
- content: "<h1><center>You are seeing a httpd server running in {{ ansible_distribution }} OS </center></h1>"
- dest: /var/www/html/index.html
- owner: "{{ owner }}"
- group: "{{ group }}"
- - name: "Ubuntu OS service restart and enable"
- when: ansible_distribution == "Ubuntu" or ansible_os_family == "Debian"
- service:
- name: "{{ item }}"
- state: restarted
- enabled: true
- with_items:
- - "{{ service }}"
- - name: "Printing the myvars result"
- debug:
- var: myvar
- ### Added an instance in inventory ####
- [ec2-user@ip-172-31-10-148 ~]$ cat inventory
- [amazon]
- 172.31.10.148 ansible_ssh_user="ec2-user" ansible_ssh_private_key_file="aws.pem"
- 172.31.0.74 ansible_ssh_user="ec2-user" ansible_ssh_private_key_file="aws.pem"
- [ubuntu]
- 172.31.45.6 ansible_ssh_user="ubuntu" ansible_ssh_private_key_file="aws.pem"
- ### hostvars tree result ####
- [ec2-user@ip-172-31-10-148 ~]$ tree host_vars/
- host_vars/
- ├── 172.31.10.148
- └── 172.31.45.6
- #### Output failed ###
- ec2-user@ip-172-31-10-148 ~]$ ansible-playbook -i inventory main.yml
- PLAY [Variable checking] ***********************************************************************************************
- TASK [Gathering Facts] *************************************************************************************************
- ok: [172.31.45.6]
- ok: [172.31.0.74]
- ok: [172.31.10.148]
- TASK [Install httpd package for Amazon OS] *****************************************************************************
- skipping: [172.31.45.6]
- ok: [172.31.10.148]
- changed: [172.31.0.74]
- TASK [Copy the content for index.html] *********************************************************************************
- skipping: [172.31.45.6]
- ok: [172.31.10.148]
- changed: [172.31.0.74]
- TASK [Amazon OS service restart and enable] ****************************************************************************
- skipping: [172.31.45.6] => (item=apache2)
- skipping: [172.31.45.6] => (item=php8.1-fpm)
- skipping: [172.31.45.6]
- changed: [172.31.0.74] => (item=httpd)
- changed: [172.31.10.148] => (item=httpd)
- changed: [172.31.10.148] => (item=php-fpm)
- changed: [172.31.0.74] => (item=php-fpm)
- TASK [Install httpd package for ubuntu OS] *****************************************************************************
- skipping: [172.31.10.148]
- skipping: [172.31.0.74]
- ok: [172.31.45.6]
- TASK [Copy the content for index.html] *********************************************************************************
- skipping: [172.31.10.148]
- skipping: [172.31.0.74]
- ok: [172.31.45.6]
- TASK [Ubuntu OS service restart and enable] ***************************************************************************
- skipping: [172.31.10.148] => (item=httpd)
- skipping: [172.31.10.148] => (item=php-fpm)
- skipping: [172.31.10.148]
- skipping: [172.31.0.74] => (item=httpd)
- skipping: [172.31.0.74] => (item=php-fpm)
- skipping: [172.31.0.74]
- changed: [172.31.45.6] => (item=apache2)
- changed: [172.31.45.6] => (item=php8.1-fpm)
- TASK [Printing the myvars result] **************************************************************************************
- ok: [172.31.10.148] => {
- "myvar": "You are seeing the amzon OS host_vars"
- }
- ok: [172.31.0.74] => {
- "myvar": "VARIABLE IS NOT DEFINED!"
- }
- ok: [172.31.45.6] => {
- "myvar": "You are seeing the ubuntu host_vars result"
- }
- PLAY RECAP *************************************************************************************************************
- 172.31.0.74 : ok=5 changed=3 unreachable=0 failed=0 skipped=3 rescued=0 ignored=0
- 172.31.10.148 : ok=5 changed=1 unreachable=0 failed=0 skipped=3 rescued=0 ignored=0
- 172.31.45.6 : ok=5 changed=1 unreachable=0 failed=0 skipped=3 rescued=0 ignored=0
- #### Added the myvar in group_vars ####
- [ec2-user@ip-172-31-10-148 ~]$ cat group_vars/amazon
- ---
- package:
- - httpd
- - php-fpm
- service:
- - httpd
- - php-fpm
- owner: apache
- group: apache
- myvar: "You are seeing the myvar result in group_vars in amazon OS"
- #### Final Output showing the priority of host_vars and group_vars ####
- [ec2-user@ip-172-31-10-148 ~]$ ansible-playbook -i inventory main.yml
- PLAY [Variable checking] ***********************************************************************************************
- TASK [Gathering Facts] *************************************************************************************************
- ok: [172.31.0.74]
- ok: [172.31.45.6]
- ok: [172.31.10.148]
- TASK [Install httpd package for Amazon OS] *****************************************************************************
- skipping: [172.31.45.6]
- ok: [172.31.0.74]
- ok: [172.31.10.148]
- TASK [Copy the content for index.html] *********************************************************************************
- skipping: [172.31.45.6]
- ok: [172.31.0.74]
- ok: [172.31.10.148]
- TASK [Amazon OS service restart and enable] ****************************************************************************
- skipping: [172.31.45.6] => (item=apache2)
- skipping: [172.31.45.6] => (item=php8.1-fpm)
- skipping: [172.31.45.6]
- changed: [172.31.0.74] => (item=httpd)
- changed: [172.31.10.148] => (item=httpd)
- changed: [172.31.0.74] => (item=php-fpm)
- changed: [172.31.10.148] => (item=php-fpm)
- TASK [Install httpd package for ubuntu OS] *****************************************************************************
- skipping: [172.31.10.148]
- skipping: [172.31.0.74]
- ok: [172.31.45.6]
- TASK [Copy the content for index.html] *********************************************************************************
- skipping: [172.31.10.148]
- skipping: [172.31.0.74]
- ok: [172.31.45.6]
- TASK [Ubuntu OS service restart and enable] ***************************************************************************
- skipping: [172.31.10.148] => (item=httpd)
- skipping: [172.31.10.148] => (item=php-fpm)
- skipping: [172.31.10.148]
- skipping: [172.31.0.74] => (item=httpd)
- skipping: [172.31.0.74] => (item=php-fpm)
- skipping: [172.31.0.74]
- changed: [172.31.45.6] => (item=apache2)
- changed: [172.31.45.6] => (item=php8.1-fpm)
- TASK [Printing the myvars result] **************************************************************************************
- ok: [172.31.10.148] => {
- "myvar": "You are seeing the amzon OS host_vars"
- }
- ok: [172.31.0.74] => {
- "myvar": "You are seeing the myvar result in group_vars in amazon OS"
- }
- ok: [172.31.45.6] => {
- "myvar": "You are seeing the ubuntu host_vars result"
- }
- PLAY RECAP *************************************************************************************************************
- 172.31.0.74 : ok=5 changed=1 unreachable=0 failed=0 skipped=3 rescued=0 ignored=0
- 172.31.10.148 : ok=5 changed=1 unreachable=0 failed=0 skipped=3 rescued=0 ignored=0
- 172.31.45.6 : ok=5 changed=1 unreachable=0 failed=0 skipped=3 rescued=0 ignored=0
- ------------------------------ Task 2 --------------------------------
- [ec2-user@ip-172-31-10-148 smtp]$ tree
- .
- ├── aws.pem
- ├── group_vars
- │ └── all
- ├── hosts
- ├── LICENSE
- ├── nodejs.yml
- ├── passwd.vars
- └── README.md
- #### inventory file #####
- [ec2-user@ip-172-31-10-148 smtp]$ cat hosts
- [build]
- docker_build ansible_ssh_host=172.31.10.148 ansible_ssh_user="ec2-user" ansible_ssh_private_key_file="aws.pem"
- [test]
- 172.31.0.74 ansible_ssh_user="ec2-user" ansible_ssh_private_key_file="aws.pem"
- #### group_vars ####
- [ec2-user@ip-172-31-10-148 smtp]$ cat group_vars/all
- ---
- packages:
- - docker
- - git
- git_url: https://github.com/Chris-luiz-16/Simple-Nodejs-Hello-world-Docker-image-and-container-build.git
- clone_dest: /var/nodejs
- docker_name: chrisluiz16/nodejs
- #### Playbook ####
- [ec2-user@ip-172-31-10-148 smtp]$ cat nodejs.yml
- ---
- [ec2-user@ip-172-31-10-148 smtp]$ cat nodejs.yml
- ---
- - name: "Docker image build"
- hosts: build
- become: true
- vars_files:
- - passwd.vars
- tasks:
- - name: "Install required packages for docker build"
- yum:
- name: "{{ packages }}"
- state: present
- - name: "Adding a secondary user docker for the user ec2-user"
- user:
- name: ec2-user
- groups: docker
- append: true
- - name: "Starng/enabibling the docker service"
- service:
- name: docker
- state: started
- enabled: true
- - name: "git cloning the nodejs application"
- git:
- repo: "{{ git_url }}"
- dest: "{{ clone_dest }}"
- register: git_status
- - name: "Printing the git commit id's"
- debug:
- var: git_status
- - name: "Login to the dockerhub"
- when: git_status.changed == true
- docker_login:
- username: "{{ docker_user }}"
- password: "{{ docker_passwd }}"
- - name: "Docker image build from Docker file"
- when: git_status.changed == true
- community.docker.docker_image:
- name: "{{ docker_name }}"
- source: build
- build:
- path: "{{ clone_dest }}"
- pull: true
- tag: "{{ item }}"
- push: true
- force_tag: true
- force_source: true
- with_items:
- - latest
- - "{{ git_status.after }}"
- register: build_status
- - name: "Deleting the local image build"
- when: git_status.changed == true
- community.docker.docker_image:
- name: "{{ docker_name }}"
- tag: "{{ item }}"
- state: absent
- with_items:
- - latest
- - "{{ git_status.after }}"
- - name: "Logout docker hub"
- when: git_status.changed == true
- docker_login:
- username: "{{ docker_user }}"
- password: "{{ docker_passwd }}"
- state: absent
- - name: "Running a nodejs container in test server"
- hosts: test
- become: true
- vars_files:
- - passwd.vars
- tasks:
- - name: "Installing required packages for the nodejs docker container"
- yum:
- name: "{{ packages }}"
- state: present
- - name: "Adding docker as a secondary user in ec2-user"
- user:
- name: ec2-user
- groups: docker
- append: true
- - name: " Starting & enable docker service"
- service:
- name: docker
- state: started
- enabled: true
- - name: "Pulling the docker image to the test server"
- community.docker.docker_image:
- name: "{{ docker_name }}"
- source: pull
- force_source: true
- register: image_status
- - name: "Creating a node js container in test server"
- when: image_status.changed == true
- docker_container:
- name: nodejsctr
- image: "{{ docker_name }}"
- recreate: true
- restart_policy: always
- published_ports: 80:3000
- - name: "Remove dangling image if any"
- when: image_status.changed == true
- community.docker.docker_prune:
- images: true
- images_filters:
- dangling: true
- - name: "Inform the client changes has made"
- when: image_status.changed == true
- community.general.mail:
- host: smtp.gmail.com
- port: 587
- sender: "{{ username }}"
- username: "{{ username }}"
- password: "{{ password }}"
- subject: "Docker new container deployed and image pushed to dockerhub on {{ ansible_date_time.day }}/{{ ansible_date_time.month }}/{{ ansible_date_time.year }} at {{ ansible_date_time.time }}"
- body: "A new change to the docker image {{ docker_name }} with tag {{ hostvars.docker_build.git_status.after }} has been successfully pushed to docker hub account and a new container has been deployed."ount and a new container has been deployed."
- #### Output ####
- [ec2-user@ip-172-31-10-148 smtp]$ ansible-playbook -i hosts nodejs.yml --ask-vault-password
- Vault password:
- PLAY [Docker image build] **********************************************************************************************
- TASK [Gathering Facts] *************************************************************************************************
- [WARNING]: Platform linux on host docker_build is using the discovered Python interpreter at /usr/bin/python3.9, but
- future installation of another Python interpreter could change the meaning of that path. See
- https://docs.ansible.com/ansible-core/2.15/reference_appendices/interpreter_discovery.html for more information.
- ok: [docker_build]
- TASK [Install required packages for docker build] **********************************************************************
- ok: [docker_build]
- TASK [Adding a secondary user docker for the user ec2-user] ************************************************************
- ok: [docker_build]
- TASK [Starng/enabibling the docker service] ****************************************************************************
- ok: [docker_build]
- TASK [git cloning the nodejs application] ******************************************************************************
- changed: [docker_build]
- TASK [Printing the git commit id's] ************************************************************************************
- ok: [docker_build] => {
- "git_status": {
- "after": "788cc6417f1e8bf82024703773f23c1f369fa617",
- "before": "fccdc6d9abc0922aef927cfb9601a827deeca78b",
- "changed": true,
- "failed": false,
- "remote_url_changed": false
- }
- }
- TASK [Login to the dockerhub] ******************************************************************************************
- changed: [docker_build]
- TASK [Docker image build from Docker file] *****************************************************************************
- changed: [docker_build] => (item=latest)
- ok: [docker_build] => (item=788cc6417f1e8bf82024703773f23c1f369fa617)
- TASK [Deleting the local image build] **********************************************************************************
- changed: [docker_build] => (item=latest)
- changed: [docker_build] => (item=788cc6417f1e8bf82024703773f23c1f369fa617)
- TASK [Logout docker hub] ***********************************************************************************************
- changed: [docker_build]
- PLAY [Running a nodejs container in test server] ***********************************************************************
- TASK [Gathering Facts] *************************************************************************************************
- [WARNING]: Platform linux on host 172.31.0.74 is using the discovered Python interpreter at /usr/bin/python3.9, but
- future installation of another Python interpreter could change the meaning of that path. See
- https://docs.ansible.com/ansible-core/2.15/reference_appendices/interpreter_discovery.html for more information.
- ok: [172.31.0.74]
- TASK [Installing required packages for the nodejs docker container] ****************************************************
- ok: [172.31.0.74]
- TASK [Adding docker as a secondary user in ec2-user] *******************************************************************
- ok: [172.31.0.74]
- TASK [Starting & enable docker service] ********************************************************************************
- ok: [172.31.0.74]
- TASK [Pulling the docker image to the test server] *********************************************************************
- changed: [172.31.0.74]
- TASK [Creating a node js container in test server] *********************************************************************
- changed: [172.31.0.74]
- TASK [Remove dangling image if any] ************************************************************************************
- changed: [172.31.0.74]
- TASK [Inform the client changes has made] ******************************************************************************
- ok: [172.31.0.74]
- PLAY RECAP *************************************************************************************************************
- 172.31.0.74 : ok=8 changed=3 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
- docker_build : ok=10 changed=5 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
Advertisement
Add Comment
Please, Sign In to add comment