Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ####---------------------------------- Task 1 --------------------####
- [ec2-user@ip-172-31-35-28 ~]$ touch main.yml variables.yml aws.pem inventory
- [ec2-user@ip-172-31-35-28 apache-project]$ cat .gitignore
- aws.pem
- inventory
- [ec2-user@ip-172-31-35-28 apache-project]$
- [ec2-user@ip-172-31-35-28 apache-project]$
- [ec2-user@ip-172-31-35-28 apache-project]$
- [ec2-user@ip-172-31-35-28 apache-project]$ git init
- [ec2-user@ip-172-31-35-28 apache-project]$ git status
- On branch master
- No commits yet
- Untracked files:
- (use "git add <file>..." to include in what will be committed)
- .gitignore
- main.yml
- variables.yml
- nothing added to commit but untracked files present (use "git add" to track)
- [ec2-user@ip-172-31-35-28 apache-project]$
- #### First Commit #####
- [ec2-user@ip-172-31-35-28 apache-project]$ cat variables.yml
- ---
- packages:
- - httpd
- - php-fpm
- [ec2-user@ip-172-31-35-28 apache-project]$ cat main.yml
- ---
- - name: "Apache installation"
- hosts: amazon
- become: true
- vars_files:
- - variables.yml
- tasks:
- - name: "Installing the apache packages"
- yum:
- name: "{{ packages }}"
- state: present
- - name: "Service restart apache"
- service:
- name: "{{ item }}"
- state: restarted
- enabled: true
- with_items:
- - "{{ packages }}"
- [ec2-user@ip-172-31-35-28 apache-project]$ ansible-playbook -i inventory main.yml --syntax-check
- playbook: main.yml
- [ec2-user@ip-172-31-35-28 apache-project]$ ansible-playbook -i inventory main.yml
- PLAY [Apache installation] *********************************************************************************************
- TASK [Gathering Facts] *************************************************************************************************ok: [client]
- TASK [Installing the apache packages] **********************************************************************************changed: [client]
- TASK [Service restart apache] ******************************************************************************************changed: [client] => (item=httpd)
- changed: [client] => (item=php-fpm)
- PLAY RECAP *************************************************************************************************************
- client : ok=3 changed=2 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
- [ec2-user@ip-172-31-35-28 apache-project]$ git status
- On branch master
- No commits yet
- Untracked files:
- (use "git add <file>..." to include in what will be committed)
- .gitignore
- main.yml
- variables.yml
- nothing added to commit but untracked files present (use "git add" to track)
- [ec2-user@ip-172-31-35-28 apache-project]$
- [ec2-user@ip-172-31-35-28 apache-project]$
- [ec2-user@ip-172-31-35-28 apache-project]$ git add .
- [ec2-user@ip-172-31-35-28 apache-project]$
- [ec2-user@ip-172-31-35-28 apache-project]$ git status
- On branch master
- No commits yet
- Changes to be committed:
- (use "git rm --cached <file>..." to unstage)
- new file: .gitignore
- new file: main.yml
- new file: variables.yml
- [ec2-user@ip-172-31-35-28 apache-project]$
- [ec2-user@ip-172-31-35-28 apache-project]$
- [ec2-user@ip-172-31-35-28 apache-project]$
- [ec2-user@ip-172-31-35-28 apache-project]$ git commit -m "apache webserver installed and restarted"
- [master (root-commit) 49255a4] apache webserver installed and restarted
- 3 files changed, 27 insertions(+)
- create mode 100644 .gitignore
- create mode 100644 main.yml
- create mode 100644 variables.yml
- [ec2-user@ip-172-31-35-28 apache-project]$
- [ec2-user@ip-172-31-35-28 apache-project]$ git status
- On branch master
- nothing to commit, working tree clean
- [ec2-user@ip-172-31-35-28 apache-project]$
- [ec2-user@ip-172-31-35-28 apache-project]$ git log
- commit 49255a4d4cb2dfc32b628e42b1ad7df33abc8311 (HEAD -> master)
- Author: chrisluiz <[email protected]>
- Date: Fri Jul 7 15:32:22 2023 +0000
- apache webserver installed and restarted
- [ec2-user@ip-172-31-35-28 apache-project]$
- #### Second Commit #####
- ---
- packages:
- - httpd
- - php-fpm
- httpd_owner: apache
- httpd_group: apache
- [ec2-user@ip-172-31-35-28 apache-project]$
- [ec2-user@ip-172-31-35-28 apache-project]$
- [ec2-user@ip-172-31-35-28 apache-project]$ cat main.yml
- ---
- - name: "Apache installation"
- hosts: amazon
- become: true
- vars_files:
- - variables.yml
- tasks:
- - name: "Installing the apache packages"
- yum:
- name: "{{ packages }}"
- state: present
- - name: "Uploading the test contantents"
- copy:
- src: "{{ item }"
- dest: /var/www/html
- owner: "{{ httpd_owner }}"
- group: "{{ httpd_group }}"
- - name: "Service restart apache"
- service:
- name: "{{ item }}"
- state: restarted
- enabled: true
- with_items:
- - "{{ packages }}"
- [ec2-user@ip-172-31-35-28 apache-project]$ git status
- On branch master
- Changes not staged for commit:
- (use "git add <file>..." to update what will be committed)
- (use "git restore <file>..." to discard changes in working directory)
- modified: main.yml
- modified: variables.yml
- Untracked files:
- (use "git add <file>..." to include in what will be committed)
- test.html
- test.php
- [ec2-user@ip-172-31-35-28 apache-project]$ ansible-playbook -i inventory main.yml
- PLAY [Apache installation] *******************************************************************************************
- TASK [Gathering Facts] ***********************************************************************************************
- ok: [client]
- TASK [Installing the apache packages] ********************************************************************************
- ok: [client]
- TASK [Uploading the test contantents] ********************************************************************************
- changed: [client] => (item=test.php)
- changed: [client] => (item=test.html)
- TASK [Service restart apache] ****************************************************************************************
- changed: [client] => (item=httpd)
- changed: [client] => (item=php-fpm)
- PLAY RECAP ***********************************************************************************************************
- client : ok=4 changed=2 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
- [ec2-user@ip-172-31-35-28 apache-project]$ git add .
- [ec2-user@ip-172-31-35-28 apache-project]$
- [ec2-user@ip-172-31-35-28 apache-project]$
- [ec2-user@ip-172-31-35-28 apache-project]$ git status
- On branch master
- Changes to be committed:
- (use "git restore --staged <file>..." to unstage)
- modified: main.yml
- new file: test.html
- new file: test.php
- modified: variables.yml
- [ec2-user@ip-172-31-35-28 apache-project]$ git log
- commit 918b3a1d59cf3bfdd1e22a3e4633475d807a7f88 (HEAD -> master)
- Author: chrisluiz <[email protected]>
- Date: Fri Jul 7 15:43:19 2023 +0000
- php support added
- commit 49255a4d4cb2dfc32b628e42b1ad7df33abc8311
- Author: chrisluiz <[email protected]>
- Date: Fri Jul 7 15:32:22 2023 +0000
- apache webserver installed and restarted
- [ec2-user@ip-172-31-35-28 apache-project]$
- [ec2-user@ip-172-31-35-28 apache-project]$ git cat-file -p 918b3a1d59cf3bfdd1e22a3e4633475d807a7f88
- tree ae05bf53a23a181f464eb49111aae03de92ec853
- parent 49255a4d4cb2dfc32b628e42b1ad7df33abc8311
- author chrisluiz <[email protected]> 1688744599 +0000
- committer chrisluiz <[email protected]> 1688744599 +0000
- php support added
- ### Third Commit ###
- [ec2-user@ip-172-31-35-28 apache-project]$ ansible -i inventory amazon -b -m fetch -a "src=/etc/httpd/conf/httpd.conf dest=./ flat=true"
- client | CHANGED => {
- "changed": true,
- "checksum": "fcfc3261dbe43ccf2a521213571849cf36e277c0",
- "dest": "/home/ec2-user/apache-project/httpd.conf",
- "md5sum": "abc2d98f55602c033626f046ce72fffc",
- "remote_checksum": "fcfc3261dbe43ccf2a521213571849cf36e277c0",
- "remote_md5sum": null
- }
- [ec2-user@ip-172-31-35-28 apache-project]$ cat variables.yml
- ---
- packages:
- - httpd
- - php-fpm
- httpd_owner: apache
- httpd_group: apache
- httpd_port: 8080
- [ec2-user@ip-172-31-35-28 apache-project]$
- [ec2-user@ip-172-31-35-28 apache-project]$
- [ec2-user@ip-172-31-35-28 apache-project]$ cat main.yml
- ---
- - name: "Apache installation"
- hosts: amazon
- become: true
- vars_files:
- - variables.yml
- tasks:
- - name: "Installing the apache packages"
- yum:
- name: "{{ packages }}"
- state: present
- - name: "Copying the httpd_conf.tmpl"
- copy:
- src: httpd.conf.tmpl
- dest: /etc/httpd/conf/httpd.conf
- notify:
- - restart-httpd
- - name: "Uploading the test contantents"
- copy:
- src: "{{ item }}"
- dest: /var/www/html/
- owner: "{{ httpd_owner }}"
- group: "{{ httpd_group }}"
- with_items:
- - test.php
- - test.html
- notify:
- - restart-php
- handlers:
- - name: "restart-php"
- service:
- name: php-fpm
- state: restarted
- enabled: true
- - name: "restart-httpd"
- service:
- name: httpd
- state: restarted
- enabled: true
- ec2-user@ip-172-31-35-28 apache-project]$ ansible-playbook -i inventory main.yml
- PLAY [Apache installation] *******************************************************************************************
- TASK [Gathering Facts] ***********************************************************************************************
- ok: [client]
- TASK [Installing the apache packages] ********************************************************************************
- ok: [client]
- TASK [Copying the httpd_conf.tmpl] ***********************************************************************************
- changed: [client]
- TASK [Uploading the test contantents] ********************************************************************************
- ok: [client] => (item=test.php)
- ok: [client] => (item=test.html)
- RUNNING HANDLER [restart-httpd] **************************************************************************************
- changed: [client]
- PLAY RECAP ***********************************************************************************************************
- client : ok=5 changed=2 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
- [ec2-user@ip-172-31-35-28 apache-project]$ git status
- On branch master
- Changes not staged for commit:
- (use "git add <file>..." to update what will be committed)
- (use "git restore <file>..." to discard changes in working directory)
- modified: main.yml
- modified: variables.yml
- Untracked files:
- (use "git add <file>..." to include in what will be committed)
- httpd.conf.tmpl
- no changes added to commit (use "git add" and/or "git commit -a")
- [ec2-user@ip-172-31-35-28 apache-project]$
- [ec2-user@ip-172-31-35-28 apache-project]$
- [ec2-user@ip-172-31-35-28 apache-project]$ git add .
- [ec2-user@ip-172-31-35-28 apache-project]$
- [ec2-user@ip-172-31-35-28 apache-project]$ git commit -m "Adding httpd.conf.tmpl"
- [master 14e31ef] Adding httpd.conf.tmpl
- 3 files changed, 381 insertions(+), 6 deletions(-)
- create mode 100644 httpd.conf.tmpl
- [ec2-user@ip-172-31-35-28 apache-project]$
- [ec2-user@ip-172-31-35-28 apache-project]$
- [ec2-user@ip-172-31-35-28 apache-project]$ git status
- On branch master
- nothing to commit, working tree clean
- [ec2-user@ip-172-31-35-28 apache-project]$
- [ec2-user@ip-172-31-35-28 apache-project]$ git log
- commit 14e31efa9fc6df1eb1850b8c1fbc7c089cd42708 (HEAD -> master)
- Author: chrisluiz <[email protected]>
- Date: Fri Jul 7 15:58:51 2023 +0000
- Adding httpd.conf.tmpl
- commit 918b3a1d59cf3bfdd1e22a3e4633475d807a7f88
- Author: chrisluiz <[email protected]>
- Date: Fri Jul 7 15:43:19 2023 +0000
- php support added
- commit 49255a4d4cb2dfc32b628e42b1ad7df33abc8311
- Author: chrisluiz <[email protected]>
- Date: Fri Jul 7 15:32:22 2023 +0000
- apache webserver installed and restarted
- [ec2-user@ip-172-31-35-28 apache-project]$
- #### Foourth commit ####
- [ec2-user@ip-172-31-35-28 apache-project]$ cat main.yml
- ---
- - name: "Apache installation"
- hosts: amazon
- become: true
- vars_files:
- - variables.yml
- tasks:
- - name: "Installing the apache packages"
- yum:
- name: "{{ packages }}"
- state: present
- - name: "Copying the httpd_conf.tmpl"
- template:
- src: httpd.conf.tmpl
- dest: /etc/httpd/conf/httpd.conf
- notify:
- - restart-httpd
- - name: "Copying the virtualhost.tmpl"
- template:
- src: virtualhost.conf.tmpl
- dest: /etc/httpd/conf.d/default.conf
- notify:
- - restart-httpd
- - name: "Uploading the test contantents"
- copy:
- src: "{{ item }}"
- dest: /var/www/html/
- owner: "{{ httpd_owner }}"
- group: "{{ httpd_group }}"
- with_items:
- - test.php
- - test.html
- notify:
- - restart-php
- handlers:
- - name: "restart-php"
- service:
- name: php-fpm
- state: restarted
- enabled: true
- - name: "restart-httpd"
- service:
- name: httpd
- state: restarted
- enabled: true
- [ec2-user@ip-172-31-35-28 apache-project]$ ansible-playbook -i inventory main.yml
- PLAY [Apache installation] *******************************************************************************************
- TASK [Gathering Facts] ***********************************************************************************************
- ok: [client]
- TASK [Installing the apache packages] ********************************************************************************
- ok: [client]
- TASK [Copying the httpd_conf.tmpl] ***********************************************************************************
- ok: [client]
- TASK [Copying the virtualhost.tmpl] **********************************************************************************
- changed: [client]
- TASK [Uploading the test contantents] ********************************************************************************
- ok: [client] => (item=test.php)
- ok: [client] => (item=test.html)
- RUNNING HANDLER [restart-httpd] **************************************************************************************
- changed: [client]
- PLAY RECAP ***********************************************************************************************************
- client : ok=6 changed=2 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
- [ec2-user@ip-172-31-35-28 apache-project]$ git status
- On branch master
- Changes not staged for commit:
- (use "git add <file>..." to update what will be committed)
- (use "git restore <file>..." to discard changes in working directory)
- modified: main.yml
- modified: variables.yml
- Untracked files:
- (use "git add <file>..." to include in what will be committed)
- virtualhost.conf.tmpl
- no changes added to commit (use "git add" and/or "git commit -a")
- [ec2-user@ip-172-31-35-28 apache-project]$
- [ec2-user@ip-172-31-35-28 apache-project]$
- [ec2-user@ip-172-31-35-28 apache-project]$
- [ec2-user@ip-172-31-35-28 apache-project]$
- [ec2-user@ip-172-31-35-28 apache-project]$ git add .
- [ec2-user@ip-172-31-35-28 apache-project]$
- [ec2-user@ip-172-31-35-28 apache-project]$
- [ec2-user@ip-172-31-35-28 apache-project]$ git commit -m "Virtaulhost port 80 conf added"
- [master 71f5b74] Virtaulhost port 80 conf added
- 3 files changed, 18 insertions(+)
- create mode 100644 virtualhost.conf.tmpl
- [ec2-user@ip-172-31-35-28 apache-project]$
- [ec2-user@ip-172-31-35-28 apache-project]$
- [ec2-user@ip-172-31-35-28 apache-project]$ git status
- On branch master
- nothing to commit, working tree clean
- [ec2-user@ip-172-31-35-28 apache-project]$
- [ec2-user@ip-172-31-35-28 apache-project]$ git log
- commit 71f5b7457e603c0009f4c7adf54d684a2eb82ff1 (HEAD -> master)
- Author: chrisluiz <[email protected]>
- Date: Fri Jul 7 16:14:21 2023 +0000
- Virtaulhost port 80 conf added
- commit 14e31efa9fc6df1eb1850b8c1fbc7c089cd42708
- Author: chrisluiz <[email protected]>
- Date: Fri Jul 7 15:58:51 2023 +0000
- Adding httpd.conf.tmpl
- commit 918b3a1d59cf3bfdd1e22a3e4633475d807a7f88
- Author: chrisluiz <[email protected]>
- Date: Fri Jul 7 15:43:19 2023 +0000
- php support added
- commit 49255a4d4cb2dfc32b628e42b1ad7df33abc8311
- Author: chrisluiz <[email protected]>
- Date: Fri Jul 7 15:32:22 2023 +0000
- apache webserver installed and restarted
- #### Git ammending the latest header ####
- [ec2-user@ip-172-31-35-28 apache-project]$ git commit --amend -m "virtualhostconf.tmpl 8080 added"
- [master 9bb91b7] virtualhostconf.tmpl 8080 added
- Date: Fri Jul 7 16:14:21 2023 +0000
- 3 files changed, 18 insertions(+)
- create mode 100644 virtualhost.conf.tmpl
- [ec2-user@ip-172-31-35-28 apache-project]$
- [ec2-user@ip-172-31-35-28 apache-project]$
- [ec2-user@ip-172-31-35-28 apache-project]$ git log
- commit 9bb91b78bfd4e4ba6b7720e69fc671ba025f75e5 (HEAD -> master)
- Author: chrisluiz <[email protected]>
- Date: Fri Jul 7 16:14:21 2023 +0000
- virtualhostconf.tmpl 8080 added
- commit 14e31efa9fc6df1eb1850b8c1fbc7c089cd42708
- Author: chrisluiz <[email protected]>
- Date: Fri Jul 7 15:58:51 2023 +0000
- Adding httpd.conf.tmpl
- commit 918b3a1d59cf3bfdd1e22a3e4633475d807a7f88
- Author: chrisluiz <[email protected]>
- Date: Fri Jul 7 15:43:19 2023 +0000
- php support added
- commit 49255a4d4cb2dfc32b628e42b1ad7df33abc8311
- Author: chrisluiz <[email protected]>
- Date: Fri Jul 7 15:32:22 2023 +0000
- apache webserver installed and restarted
- [ec2-user@ip-172-31-35-28 apache-project]$
- #### Adding new file ####
- [ec2-user@ip-172-31-35-28 apache-project]$ echo "This is a new line">>newline.txt
- [ec2-user@ip-172-31-35-28 apache-project]$
- [ec2-user@ip-172-31-35-28 apache-project]$
- [ec2-user@ip-172-31-35-28 apache-project]$ git ls-files -s
- 100644 7e766e72a428da4d2daa930736890495bcd79070 0 .gitignore
- 100644 41c670e5de1326c3d97265aaa1237659b2463e0b 0 httpd.conf.tmpl
- 100644 8c6d46bc6ab48087780d16aa2f7dff191737bd1f 0 main.yml
- 100644 e308298a79ff1b247125f7cf1b9a7b6f03a2323d 0 test.html
- 100644 e8d48bac9f33bdc446bc6bc947c78187b46761dd 0 test.php
- 100644 6e6f6b07e9b0ea6f2609d4f9f569094e513414ed 0 variables.yml
- 100644 fadbf3dbd16812dea171216cee18a886ddd1b4d1 0 virtualhost.conf.tmpl
- [ec2-user@ip-172-31-35-28 apache-project]$
- [ec2-user@ip-172-31-35-28 apache-project]$
- [ec2-user@ip-172-31-35-28 apache-project]$ git status
- On branch master
- Untracked files:
- (use "git add <file>..." to include in what will be committed)
- newline.txt
- nothing added to commit but untracked files present (use "git add" to track)
- [ec2-user@ip-172-31-35-28 apache-project]$
- [ec2-user@ip-172-31-35-28 apache-project]$ git add newline.txt
- [ec2-user@ip-172-31-35-28 apache-project]$
- [ec2-user@ip-172-31-35-28 apache-project]$ git status
- On branch master
- nothing to commit, working tree clean
- [ec2-user@ip-172-31-35-28 apache-project]$
- [ec2-user@ip-172-31-35-28 apache-project]$ git commit --amend --no-edit
- [master cc4555c] virtualhostconf.tmpl 8080 added
- Date: Fri Jul 7 16:14:21 2023 +0000
- 4 files changed, 19 insertions(+)
- create mode 100644 newline.txt
- create mode 100644 virtualhost.conf.tmpl
- [ec2-user@ip-172-31-35-28 apache-project]$ git status
- On branch master
- nothing to commit, working tree clean
- [ec2-user@ip-172-31-35-28 apache-project]$ git log
- commit cc4555c154a80f89136b26196076e3250cccd319 (HEAD -> master)
- Author: chrisluiz <[email protected]>
- Date: Fri Jul 7 16:14:21 2023 +0000
- virtualhostconf.tmpl 8080 added
- commit 14e31efa9fc6df1eb1850b8c1fbc7c089cd42708
- Author: chrisluiz <[email protected]>
- Date: Fri Jul 7 15:58:51 2023 +0000
- Adding httpd.conf.tmpl
- commit 918b3a1d59cf3bfdd1e22a3e4633475d807a7f88
- Author: chrisluiz <[email protected]>
- Date: Fri Jul 7 15:43:19 2023 +0000
- php support added
- commit 49255a4d4cb2dfc32b628e42b1ad7df33abc8311
- Author: chrisluiz <[email protected]>
- Date: Fri Jul 7 15:32:22 2023 +0000
- apache webserver installed and restarted
- [ec2-user@ip-172-31-35-28 apache-project]$ git ls-files -s
- 100644 7e766e72a428da4d2daa930736890495bcd79070 0 .gitignore
- 100644 41c670e5de1326c3d97265aaa1237659b2463e0b 0 httpd.conf.tmpl
- 100644 8c6d46bc6ab48087780d16aa2f7dff191737bd1f 0 main.yml
- 100644 1ac99b8906e05692417c5b96a0829f7d6b1d607f 0 newline.txt
- 100644 e308298a79ff1b247125f7cf1b9a7b6f03a2323d 0 test.html
- 100644 e8d48bac9f33bdc446bc6bc947c78187b46761dd 0 test.php
- 100644 6e6f6b07e9b0ea6f2609d4f9f569094e513414ed 0 variables.yml
- 100644 fadbf3dbd16812dea171216cee18a886ddd1b4d1 0 virtualhost.conf.tmpl
- #### Creating a new branch and 5th commit #####
- [ec2-user@ip-172-31-35-28 apache-project]$ git branch mariadb
- [ec2-user@ip-172-31-35-28 apache-project]$ git log
- commit cc4555c154a80f89136b26196076e3250cccd319 (HEAD -> master, mariadb)
- Author: chrisluiz <[email protected]>
- Date: Fri Jul 7 16:14:21 2023 +0000
- virtualhostconf.tmpl 8080 added
- commit 14e31efa9fc6df1eb1850b8c1fbc7c089cd42708
- Author: chrisluiz <[email protected]>
- Date: Fri Jul 7 15:58:51 2023 +0000
- Adding httpd.conf.tmpl
- commit 918b3a1d59cf3bfdd1e22a3e4633475d807a7f88
- Author: chrisluiz <[email protected]>
- Date: Fri Jul 7 15:43:19 2023 +0000
- php support added
- commit 49255a4d4cb2dfc32b628e42b1ad7df33abc8311
- Author: chrisluiz <[email protected]>
- Date: Fri Jul 7 15:32:22 2023 +0000
- apache webserver installed and restarted
- [ec2-user@ip-172-31-35-28 apache-project]$
- [ec2-user@ip-172-31-35-28 apache-project]$ git switch mariadb
- M main.yml
- Switched to branch 'mariadb'
- [ec2-user@ip-172-31-35-28 apache-project]$
- [ec2-user@ip-172-31-35-28 apache-project]$
- [ec2-user@ip-172-31-35-28 apache-project]$
- [ec2-user@ip-172-31-35-28 apache-project]$ git log
- commit cc4555c154a80f89136b26196076e3250cccd319 (HEAD -> mariadb, master)
- Author: chrisluiz <[email protected]>
- Date: Fri Jul 7 16:14:21 2023 +0000
- virtualhostconf.tmpl 8080 added
- commit 14e31efa9fc6df1eb1850b8c1fbc7c089cd42708
- Author: chrisluiz <[email protected]>
- Date: Fri Jul 7 15:58:51 2023 +0000
- Adding httpd.conf.tmpl
- commit 918b3a1d59cf3bfdd1e22a3e4633475d807a7f88
- Author: chrisluiz <[email protected]>
- Date: Fri Jul 7 15:43:19 2023 +0000
- php support added
- commit 49255a4d4cb2dfc32b628e42b1ad7df33abc8311
- Author: chrisluiz <[email protected]>
- Date: Fri Jul 7 15:32:22 2023 +0000
- apache webserver installed and restarted
- [ec2-user@ip-172-31-35-28 apache-project]$ cat .git/refs/heads/mariadb
- cc4555c154a80f89136b26196076e3250cccd319
- ---
- - name: "Apache installation"
- hosts: amazon
- become: true
- vars_files:
- - variables.yml
- tasks:
- - name: "Installing the apache packages"
- yum:
- name: "{{ packages }}"
- state: present
- - name: "Copying the httpd_conf.tmpl"
- template:
- src: httpd.conf.tmpl
- dest: /etc/httpd/conf/httpd.conf
- notify:
- - restart-httpd
- - name: "Copying the virtualhost.tmpl"
- template:
- src: virtualhost.conf.tmpl
- dest: /etc/httpd/conf.d/default.conf
- notify:
- - restart-httpd
- - name: "Uploading the test contantents"
- copy:
- src: "{{ item }}"
- dest: /var/www/html/
- owner: "{{ httpd_owner }}"
- group: "{{ httpd_group }}"
- with_items:
- - test.php
- - test.html
- notify:
- - restart-php
- - name: "Installing mariadb"
- yum:
- name: mariadb105-server
- state: present
- handlers:
- - name: "restart-php"
- service:
- name: php-fpm
- state: restarted
- enabled: true
- - name: "restart-httpd"
- service:
- name: httpd
- state: restarted
- enabled: true
- #### Inspecting the branch #####
- [ec2-user@ip-172-31-35-28 apache-project]$ git add .
- [ec2-user@ip-172-31-35-28 apache-project]$
- [ec2-user@ip-172-31-35-28 apache-project]$
- [ec2-user@ip-172-31-35-28 apache-project]$ git status
- On branch mariadb
- Changes to be committed:
- (use "git restore --staged <file>..." to unstage)
- modified: main.yml
- [ec2-user@ip-172-31-35-28 apache-project]$
- [ec2-user@ip-172-31-35-28 apache-project]$
- [ec2-user@ip-172-31-35-28 apache-project]$ git commit -m "Mariadb Installation succefull"
- [mariadb 1f522f0] Mariadb Installation succefull
- 1 file changed, 5 insertions(+)
- [ec2-user@ip-172-31-35-28 apache-project]$
- [ec2-user@ip-172-31-35-28 apache-project]$
- [ec2-user@ip-172-31-35-28 apache-project]$ git log
- commit 1f522f00414b404c1aae2e982b244d7f1e563799 (HEAD -> mariadb)
- Author: chrisluiz <[email protected]>
- Date: Fri Jul 7 16:29:52 2023 +0000
- Mariadb Installation succefull
- commit cc4555c154a80f89136b26196076e3250cccd319 (master)
- Author: chrisluiz <[email protected]>
- Date: Fri Jul 7 16:14:21 2023 +0000
- virtualhostconf.tmpl 8080 added
- commit 14e31efa9fc6df1eb1850b8c1fbc7c089cd42708
- Author: chrisluiz <[email protected]>
- Date: Fri Jul 7 15:58:51 2023 +0000
- Adding httpd.conf.tmpl
- commit 918b3a1d59cf3bfdd1e22a3e4633475d807a7f88
- Author: chrisluiz <[email protected]>
- Date: Fri Jul 7 15:43:19 2023 +0000
- php support added
- commit 49255a4d4cb2dfc32b628e42b1ad7df33abc8311
- Author: chrisluiz <[email protected]>
- Date: Fri Jul 7 15:32:22 2023 +0000
- apache webserver installed and restarted
- [ec2-user@ip-172-31-35-28 apache-project]$
- [ec2-user@ip-172-31-35-28 apache-project]$ git cat-file -p 1f522f00414b404c1aae2e982b244d7f1e563799
- tree 6e516e3a43228c87bbc7b6f38906e3a7dd409aea
- parent cc4555c154a80f89136b26196076e3250cccd319
- author chrisluiz <[email protected]> 1688747392 +0000
- committer chrisluiz <[email protected]> 1688747392 +0000
- Mariadb Installation succefull
- [ec2-user@ip-172-31-35-28 apache-project]$ git cat-file -p cc4555c154a80f89136b26196076e3250cccd319
- tree 15bb027b7332f0828d115e8d7dfc69320519a493
- parent 14e31efa9fc6df1eb1850b8c1fbc7c089cd42708
- author chrisluiz <[email protected]> 1688746461 +0000
- committer chrisluiz <[email protected]> 1688746949 +0000
- virtualhostconf.tmpl 8080 added
- [ec2-user@ip-172-31-35-28 apache-project]$ git cat-file -p 15bb027b7332f0828d115e8d7dfc69320519a493
- 100644 blob 7e766e72a428da4d2daa930736890495bcd79070 .gitignore
- 100644 blob 41c670e5de1326c3d97265aaa1237659b2463e0b httpd.conf.tmpl
- 100644 blob 8c6d46bc6ab48087780d16aa2f7dff191737bd1f main.yml
- 100644 blob 1ac99b8906e05692417c5b96a0829f7d6b1d607f newline.txt
- 100644 blob e308298a79ff1b247125f7cf1b9a7b6f03a2323d test.html
- 100644 blob e8d48bac9f33bdc446bc6bc947c78187b46761dd test.php
- 100644 blob 6e6f6b07e9b0ea6f2609d4f9f569094e513414ed variables.yml
- 100644 blob fadbf3dbd16812dea171216cee18a886ddd1b4d1 virtualhost.conf.tmpl
- [ec2-user@ip-172-31-35-28 apache-project]$ git cat-file -p 8c6d46bc6ab48087780d16aa2f7dff191737bd1f
- ---
- - name: "Apache installation"
- hosts: amazon
- become: true
- vars_files:
- - variables.yml
- tasks:
- - name: "Installing the apache packages"
- yum:
- name: "{{ packages }}"
- state: present
- - name: "Copying the httpd_conf.tmpl"
- template:
- src: httpd.conf.tmpl
- dest: /etc/httpd/conf/httpd.conf
- notify:
- - restart-httpd
- - name: "Copying the virtualhost.tmpl"
- template:
- src: virtualhost.conf.tmpl
- dest: /etc/httpd/conf.d/default.conf
- notify:
- - restart-httpd
- - name: "Uploading the test contantents"
- copy:
- src: "{{ item }}"
- dest: /var/www/html/
- owner: "{{ httpd_owner }}"
- group: "{{ httpd_group }}"
- with_items:
- - test.php
- - test.html
- notify:
- - restart-php
- handlers:
- - name: "restart-php"
- service:
- name: php-fpm
- state: restarted
- enabled: true
- - name: "restart-httpd"
- service:
- name: httpd
- state: restarted
- enabled: true
- #### 6th commit in mariadb branch ####
- [ec2-user@ip-172-31-35-28 apache-project]$ cat main.yml
- ---
- - name: "Apache installation"
- hosts: amazon
- become: true
- vars_files:
- - variables.yml
- tasks:
- - name: "Installing the apache packages"
- yum:
- name: "{{ packages }}"
- state: present
- - name: "Copying the httpd_conf.tmpl"
- template:
- src: httpd.conf.tmpl
- dest: /etc/httpd/conf/httpd.conf
- notify:
- - restart-httpd
- - name: "Copying the virtualhost.tmpl"
- template:
- src: virtualhost.conf.tmpl
- dest: /etc/httpd/conf.d/default.conf
- notify:
- - restart-httpd
- - name: "Uploading the test contantents"
- copy:
- src: "{{ item }}"
- dest: /var/www/html/
- owner: "{{ httpd_owner }}"
- group: "{{ httpd_group }}"
- with_items:
- - test.php
- - test.html
- notify:
- - restart-php
- - name: "Installing mariadb"
- yum:
- name: mariadb105-server
- state: present
- - name: "Service Start/emnable mariadb"
- service:
- name: mariadb
- state: started
- enabled: true
- - name: "Installing mysql pip required modules"
- pip:
- name: PyMySQL
- - name: "Changing mysql root password"
- community.mysql.mysql_user:
- login_user: root
- login_password: ""
- login_unix_socket: /var/lib/mysql/mysql.sock
- name: root
- password: "{{ mysql_passwd }}"
- handlers:
- - name: "restart-php"
- service:
- name: php-fpm
- state: restarted
- enabled: true
- - name: "restart-httpd"
- service:
- name: httpd
- state: restarted
- enabled: true
- [ec2-user@ip-172-31-35-28 apache-project]$ git status
- On branch mariadb
- Changes not staged for commit:
- (use "git add <file>..." to update what will be committed)
- (use "git restore <file>..." to discard changes in working directory)
- modified: main.yml
- modified: variables.yml
- [ec2-user@ip-172-31-35-28 apache-project]$ git add .
- [ec2-user@ip-172-31-35-28 apache-project]$
- [ec2-user@ip-172-31-35-28 apache-project]$
- [ec2-user@ip-172-31-35-28 apache-project]$ git status
- On branch mariadb
- Changes to be committed:
- (use "git restore --staged <file>..." to unstage)
- modified: main.yml
- modified: variables.yml
- [ec2-user@ip-172-31-35-28 apache-project]$
- [ec2-user@ip-172-31-35-28 apache-project]$
- [ec2-user@ip-172-31-35-28 apache-project]$ git commit -m "Mysql root passwd changed"
- [mariadb 17b7a35] Mysql root passwd changed
- 2 files changed, 17 insertions(+)
- [ec2-user@ip-172-31-35-28 apache-project]$
- [ec2-user@ip-172-31-35-28 apache-project]$
- [ec2-user@ip-172-31-35-28 apache-project]$ git log
- commit 17b7a35f8ba62daa350eb1d0651180312e70be2f (HEAD -> mariadb)
- Author: chrisluiz <[email protected]>
- Date: Fri Jul 7 16:40:33 2023 +0000
- Mysql root passwd changed
- commit 1f522f00414b404c1aae2e982b244d7f1e563799
- Author: chrisluiz <[email protected]>
- Date: Fri Jul 7 16:29:52 2023 +0000
- Mariadb Installation succefull
- commit cc4555c154a80f89136b26196076e3250cccd319 (master)
- Author: chrisluiz <[email protected]>
- Date: Fri Jul 7 16:14:21 2023 +0000
- virtualhostconf.tmpl 8080 added
- commit 14e31efa9fc6df1eb1850b8c1fbc7c089cd42708
- Author: chrisluiz <[email protected]>
- Date: Fri Jul 7 15:58:51 2023 +0000
- Adding httpd.conf.tmpl
- commit 918b3a1d59cf3bfdd1e22a3e4633475d807a7f88
- Author: chrisluiz <[email protected]>
- Date: Fri Jul 7 15:43:19 2023 +0000
- php support added
- commit 49255a4d4cb2dfc32b628e42b1ad7df33abc8311
- Author: chrisluiz <[email protected]>
- Date: Fri Jul 7 15:32:22 2023 +0000
- apache webserver installed and restarted
- #### Switching from mariadb to master branc ####
- [ec2-user@ip-172-31-35-28 apache-project]$ git switch master
- Switched to branch 'master'
- [ec2-user@ip-172-31-35-28 apache-project]$
- [ec2-user@ip-172-31-35-28 apache-project]$
- [ec2-user@ip-172-31-35-28 apache-project]$ git log
- commit cc4555c154a80f89136b26196076e3250cccd319 (HEAD -> master)
- Author: chrisluiz <[email protected]>
- Date: Fri Jul 7 16:14:21 2023 +0000
- virtualhostconf.tmpl 8080 added
- commit 14e31efa9fc6df1eb1850b8c1fbc7c089cd42708
- Author: chrisluiz <[email protected]>
- Date: Fri Jul 7 15:58:51 2023 +0000
- Adding httpd.conf.tmpl
- commit 918b3a1d59cf3bfdd1e22a3e4633475d807a7f88
- Author: chrisluiz <[email protected]>
- Date: Fri Jul 7 15:43:19 2023 +0000
- php support added
- commit 49255a4d4cb2dfc32b628e42b1ad7df33abc8311
- Author: chrisluiz <[email protected]>
- Date: Fri Jul 7 15:32:22 2023 +0000
- apache webserver installed and restarted
- [ec2-user@ip-172-31-35-28 apache-project]$ cat main.yml
- ---
- - name: "Apache installation"
- hosts: amazon
- become: true
- vars_files:
- - variables.yml
- tasks:
- - name: "Installing the apache packages"
- yum:
- name: "{{ packages }}"
- state: present
- - name: "Copying the httpd_conf.tmpl"
- template:
- src: httpd.conf.tmpl
- dest: /etc/httpd/conf/httpd.conf
- notify:
- - restart-httpd
- - name: "Copying the virtualhost.tmpl"
- template:
- src: virtualhost.conf.tmpl
- dest: /etc/httpd/conf.d/default.conf
- notify:
- - restart-httpd
- - name: "Uploading the test contantents"
- copy:
- src: "{{ item }}"
- dest: /var/www/html/
- owner: "{{ httpd_owner }}"
- group: "{{ httpd_group }}"
- with_items:
- - test.php
- - test.html
- notify:
- - restart-php
- handlers:
- - name: "restart-php"
- service:
- name: php-fpm
- state: restarted
- enabled: true
- - name: "restart-httpd"
- service:
- name: httpd
- state: restarted
- enabled: true
Advertisement
Add Comment
Please, Sign In to add comment