ansible [core 2.16.7]
config file = None
configured module search path = ['/home/vagrant/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/vagrant/ansible/lib/python3.12/site-packages/ansible
ansible collection location = /home/vagrant/.ansible/collections:/usr/share/ansible/collections
executable location = /home/vagrant/ansible/bin/ansible
python version = 3.12.3 (main, Apr 10 2024, 05:33:47) [GCC 13.2.0] (/home/vagrant/ansible/bin/python3)
jinja version = 3.1.4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -eu -o pipefail | |
if ! command -v VBoxManage &> /dev/null; then | |
echo "[ERROR] VirtualBox is not installed" | |
exit 1 | |
fi | |
if ! command -v vagrant &> /dev/null; then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat test.yml | |
--- | |
- name: Testing | |
hosts: localhost | |
any_errors_fatal: true | |
gather_facts: false | |
tasks: | |
- name: Set sysctl configuration directory as fact | |
block: | |
- name: Stat /usr/lib/sysctl.d/ exists |
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/oracle-virtualbox-2016.gpg] https://download.virtualbox.org/virtualbox/debian $(lsb_release -cs) contrib" | sudo tee /etc/apt/sources.list.d/virtualbox.list
wget -O- https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
wget -O- https://www.virtualbox.org/download/oracle_vbox_2016.asc | sudo gpg --dearmor --yes --output /usr/share/keyrings/oracle-virtualbox-2016.gpg
sudo apt-get --assume-yes update
sudo apt-get --assume-yes upgrade
sudo apt-get --assume-yes install libssl-dev python3-pip vagrant virtualbox
vagrant plugin install vagrant-scp
vagrant plugin install vagrant-vbguest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ pip3 install -U ansible-core ansible-lint molecule "molecule-plugins[vagrant]" | |
[...] | |
WARNING: molecule-plugins 23.4.0 does not provide the extra 'vagrant' | |
[...] | |
$ pip3 install -U ansible-core ansible-lint molecule molecule-plugins molecule-vagrant | |
$ molecule check | |
Traceback (most recent call last): | |
File "/home/ubuntu/py310/bin/molecule", line 8, in <module> | |
sys.exit(main()) | |
File "/home/ubuntu/py310/lib/python3.10/site-packages/click/core.py", line 1130, in __call__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ubuntu_script = <<-'UBUNTU' | |
apt-get update | |
apt-get --assume-yes upgrade | |
apt-get --assume-yes install build-essential maven openjdk-17-jdk python3-dev python3-pip | |
echo " | |
export JDK_HOME=/usr/lib/jvm/java-17-openjdk-amd64 | |
export JAVA_HOME=\$JDK_HOME | |
export PIP_NO_BINARY=jpy | |
export PATH=\$PATH:~/.local/bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$script = <<-'SCRIPT' | |
apt-get update | |
curl -sSL get.docker.com | sh && sudo addgroup vagrant docker | |
curl https://raw.githubusercontent.com/nektos/act/master/install.sh | bash | |
SCRIPT | |
Vagrant.configure("2") do |config| | |
config.vbguest.installer_options = { allow_kernel_upgrade: true } | |
config.vm.provider "virtualbox" do |v| | |
v.memory = 2048 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- hosts: localhost | |
tasks: | |
- name: 8 character random string | |
ansible.builtin.set_fact: | |
generated_password: "{{ lookup('community.general.random_string', min_lower=1, min_upper=1, min_special=1, min_numeric=1) }}" | |
register: password | |
- name: print registered password | |
debug: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- hosts: all | |
any_errors_fatal: true | |
gather_facts: false | |
vars: | |
a: | |
b: 2 | |
c: 3 | |
tasks: | |
- name: inline if |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# So sorry it had to come to this, this is slow. | |
# Note that pim and keyfiles etc is static and needs to be modified if used. | |
# veracrypt --text --dismount --slot 1 | |
set -eu -o pipefail | |
CONTAINER="" | |
MOUNTDIR="" | |
WORDLIST="" |
NewerOlder