ansible vagarnt ubuntu with jdk install
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|
# config.vm.provision "shell", inline: <<-SHELL
[root@vagrant ~]# cat Vagrantfile | grep playbook
ansible.playbook = "playbook.yml"
ansible.playbook = "jdk.yml"
[root@vagrant ~]# vi playbook.yml
root@vagrant ~]# vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'ubuntu/bionic64' is up to date...
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: flag to force provisioning. Provisioners marked to run always will still run.
[root@vagrant ~]#
[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]
PLAY RECAP *********************************************************************
default : ok=3 changed=0 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:01:16 UTC 2019
System load: 0.36 Processes: 96
Usage of /: 19.1% of 9.63GB Users logged in: 0
Memory usage: 17% 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:01:01 2019 from 10.0.2.2
vagrant@ubuntu-bionic:~$ rpm
# 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|
# config.vm.provision "shell", inline: <<-SHELL
[root@vagrant ~]# cat Vagrantfile | grep playbook
ansible.playbook = "playbook.yml"
ansible.playbook = "jdk.yml"
[root@vagrant ~]# vi playbook.yml
--
- hosts: all
gather_facts: yes
become: true
vi jdk.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 JDK 11
apt:
name: openjdk-11-jdk
state: present
root@vagrant ~]# vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'ubuntu/bionic64' is up to date...
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: flag to force provisioning. Provisioners marked to run always will still run.
[root@vagrant ~]#
[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]
PLAY RECAP *********************************************************************
default : ok=3 changed=0 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:01:16 UTC 2019
System load: 0.36 Processes: 96
Usage of /: 19.1% of 9.63GB Users logged in: 0
Memory usage: 17% 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:01:01 2019 from 10.0.2.2
vagrant@ubuntu-bionic:~$ rpm
Comments
Post a Comment