This playbook creates a bash script from the following fork. The script sends the public IP of an instance on Oracle Cloud to YDNS. A Cron job runs the script once every hour.
- GitHub: github.com/k3karthic/bash-updater
- Codeberg: codeberg.org/k3karthic/bash-updater
Assumption: Instance deployed using either one of the Terraform scripts below,
- terraform__oci-instance-1
- terraform__oci-instance-2
Install the following before running the playbook,
pip install oci
ansible-galaxy collection install oracle.oci
The Oracle Ansible Inventory Plugin populates public Ubuntu instances.
All target Ubuntu instances must have the freeform tag ydns_host: <hostname>
.
- Update
inventory/oracle.oci.yml
,- Specify the region where you have deployed your server on Oracle Cloud. List of regions are at docs.oracle.com/en-us/iaas/Content/General/Concepts/regions.htm.
- Configure the authentication as per the Oracle Guide
- Set username and ssh authentication in
inventory/group_vars/
- Set username and password for YDNS in
inventory/group_vars/ydns.yml
. Useinventory/group_vars/ydns.yml.sample
as a reference.
To use more than a single SSH keypair (with passphrases), use ssh-agent to store them.
Run the following command to start ssh-agent
,
$ eval "$(ssh-agent -s)"
Add each keypair using the following command,
$ ssh-add <path to keypair>
Run the playbook using the following command,
./bin/apply.sh
Encrypt sensitive files (SSH private keys) before saving them. .gitignore
must contain the unencrypted file paths.
Use the following command to decrypt the files after cloning the repository,
$ ./bin/decrypt.sh
Use the following command after running terraform to update the encrypted files,
$ ./bin/encrypt.sh <gpg key id>