ansible vagrant ubuntu apache tomcat install zabbix agent

root@vagrant ~]# cat Vagrantfile | grep config
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
Vagrant.configure("2") do |config|
  # The most common configuration options are documented and commented below.
  config.vm.box = "ubuntu/bionic64"
  # config.vm.box_check_update = false
  # config.vm.network "forwarded_port", guest: 80, host: 8080
  # config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1"
  # config.vm.network "private_network", ip: "192.168.33.10"
  # config.vm.network "public_network"
  # config.vm.synced_folder "../data", "/vagrant_data"
  # Provider-specific configuration so you can fine-tune various
  # config.vm.provider "virtualbox" do |vb|
 config.vm.provision "ansible" do |ansible|

[root@vagrant ~]# cat Vagrantfile | grep playbook
    ansible.playbook = "playbook.yml"
    ansible.playbook = "apache:.yml"


apache.yml


---
- hosts: all

  become: yes
  become_method: sudo
  remote_user: ubuntu

  tasks:
  - name: Update and upgrade apt packages
    apt:
      upgrade: yes
      update_cache: yes
      cache_valid_time: 86400 #One day

- name: install apache2
    apt:
      name: apache2
      state: present


[root@vagrant ~]# vagrant provision
==> default: Running provisioner: ansible...
    default: Running ansible-playbook...

PLAY [all] *********************************************************************

TASK [Gathering Facts] *********************************************************
ok: [default]

TASK [Update and upgrade apt packages] *****************************************
ok: [default]
 [WARNING]: The value True (type bool) in a string field was converted to
'True' (type string). If this does not look like what you expect, quote the
entire value to ensure it does not change.

 [WARNING]: Could not find aptitude. Using apt-get instead


TASK [install JDK 11] **********************************************************
ok: [default]

TASK [install apache2] *********************************************************
changed: [default]

PLAY RECAP *********************************************************************
default                    : ok=4    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0 

[root@vagrant ~]# vagrant ssh
Welcome to Ubuntu 18.04.3 LTS (GNU/Linux 4.15.0-58-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  System information as of Mon Aug 26 07:18:56 UTC 2019

  System load:  1.37              Processes:             104
  Usage of /:   19.2% of 9.63GB   Users logged in:       0
  Memory usage: 18%               IP address for enp0s3: 10.0.2.15
  Swap usage:   0%

 * Keen to learn Istio? It's included in the single-package MicroK8s.

     https://snapcraft.io/microk8s

 * Canonical Livepatch is available for installation.
   - Reduce system reboots and improve kernel security. Activate at:
     https://ubuntu.com/livepatch

0 packages can be updated.
0 updates are security updates.


Last login: Mon Aug 26 07:17:53 2019 from 10.0.2.2

vagrant@ubuntu-bionic:~$ apache2
[Mon Aug 26 07:19:06.568354 2019] [core:warn] [pid 10047] AH00111: Config variable ${APACHE_RUN_DIR} is not defined
apache2: Syntax error on line 80 of /etc/apache2/apache2.conf: DefaultRuntimeDir must be a valid directory, absolute or relative to ServerRoot
vagrant@ubuntu-bionic:~$
vagrant@ubuntu-bionic:~$

[root@vagrant ~]# vi tomcat.yml
[root@vagrant ~]# vagrant provision
==> default: Running provisioner: ansible...
    default: Running ansible-playbook...

PLAY [all] *********************************************************************

TASK [Gathering Facts] *********************************************************
ok: [default]

TASK [Update and upgrade apt packages] *****************************************
ok: [default]
 [WARNING]: The value True (type bool) in a string field was converted to
'True' (type string). If this does not look like what you expect, quote the
entire value to ensure it does not change.

 [WARNING]: Could not find aptitude. Using apt-get instead


TASK [install JDK 11] **********************************************************
ok: [default]

TASK [install apache2] *********************************************************
ok: [default]

TASK [install tomcat] **********************************************************
changed: [default]

PLAY RECAP *********************************************************************
default                    : ok=5    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0 

[root@vagrant ~]# vagrant ssh
Welcome to Ubuntu 18.04.3 LTS (GNU/Linux 4.15.0-58-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  System information as of Mon Aug 26 07:28:58 UTC 2019

  System load:  1.93              Processes:             106
  Usage of /:   19.5% of 9.63GB   Users logged in:       0
  Memory usage: 29%               IP address for enp0s3: 10.0.2.15
  Swap usage:   0%

 * Keen to learn Istio? It's included in the single-package MicroK8s.

     https://snapcraft.io/microk8s

 * Canonical Livepatch is available for installation.
   - Reduce system reboots and improve kernel security. Activate at:
     https://ubuntu.com/livepatch

0 packages can be updated.
0 updates are security updates.


Last login: Mon Aug 26 07:27:34 2019 from 10.0.2.2


vagrant@ubuntu-bionic:~$  apt list --installed | grep tomcat

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

libtomcat8-java/bionic-updates,now 8.5.39-1ubuntu1~18.04.2 all [installed,automatic]
tomcat8/bionic-updates,now 8.5.39-1ubuntu1~18.04.2 all [installed]
tomcat8-admin/bionic-updates,now 8.5.39-1ubuntu1~18.04.2 all [installed]
tomcat8-common/bionic-updates,now 8.5.39-1ubuntu1~18.04.2 all [installed]
tomcat8-docs/bionic-updates,now 8.5.39-1ubuntu1~18.04.2 all [installed]
tomcat8-examples/bionic-updates,now 8.5.39-1ubuntu1~18.04.2 all [installed]
tomcat8-user/bionic-updates,now 8.5.39-1ubuntu1~18.04.2 all [installed]
vagrant@ubuntu-bionic:~$ 



[root@vagrant ~]# vagrant provision
==> default: Running provisioner: ansible...
    default: Running ansible-playbook...

PLAY [all] *********************************************************************

TASK [Gathering Facts] *********************************************************
ok: [default]

TASK [Update and upgrade apt packages] *****************************************
ok: [default]
 [WARNING]: The value True (type bool) in a string field was converted to
'True' (type string). If this does not look like what you expect, quote the
entire value to ensure it does not change.

 [WARNING]: Could not find aptitude. Using apt-get instead


TASK [install JDK 11] **********************************************************
ok: [default]

TASK [install apache2] *********************************************************
ok: [default]

TASK [install tomcat] **********************************************************
ok: [default]

TASK [install zabbix] **********************************************************
changed: [default]

PLAY RECAP *********************************************************************
default                    : ok=6    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0 

[root@vagrant ~]#

[root@vagrant ~]# vagrant ssh
Welcome to Ubuntu 18.04.3 LTS (GNU/Linux 4.15.0-58-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  System information as of Mon Aug 26 07:46:14 UTC 2019

  System load:  0.31              Processes:             110
  Usage of /:   19.5% of 9.63GB   Users logged in:       0
  Memory usage: 29%               IP address for enp0s3: 10.0.2.15
  Swap usage:   0%

 * Keen to learn Istio? It's included in the single-package MicroK8s.

     https://snapcraft.io/microk8s

 * Canonical Livepatch is available for installation.
   - Reduce system reboots and improve kernel security. Activate at:
     https://ubuntu.com/livepatch

0 packages can be updated.
0 updates are security updates.


Last login: Mon Aug 26 07:44:27 2019 from 10.0.2.2


vagrant@ubuntu-bionic:~$ apt list --installed | grep zabbix

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

zabbix-agent/bionic,now 1:3.0.12+dfsg-1 amd64 [installed]
vagrant@ubuntu-bionic:~$



Comments