Dynamic DNS using Njalla for a Oracle Cloud instance
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
Karthic Kumaran 08c9762405
silent curl for external ip
3 months ago
bin initial commit 3 months ago
inventory initial commit 3 months ago
ssh initial commit 3 months ago
templates silent curl for external ip 3 months ago
.gitignore initial commit 3 months ago
LICENSE initial commit 3 months ago
README.md initial commit 3 months ago
site.yml initial commit 3 months ago

README.md

Ansible — Dynamic DNS using Njalla

This playbook creates a bash script from the following fork. The script sends the public IP of an instance on Oracle Cloud to Njalla. A Cron job runs the script once every hour.

Assumption: Instance deployed using either one of the Terraform scripts below,

Code Mirrors

Requirements

Install the following before running the playbook,

pip install oci
ansible-galaxy collection install oracle.oci

Dynamic Inventory

The Oracle Ansible Inventory Plugin populates public Ubuntu instances.

All target Ubuntu instances must have the freeform tags njalla_domain: <domain name> and njalla_domain_id: <record id>.

Configuration

  1. Update inventory/oracle.oci.yml,
    1. 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.
    2. Configure the authentication as per the Oracle Guide
  2. Set username and ssh authentication in inventory/group_vars/
  3. Set API Token for Njalla in inventory/group_vars/njalla.yml. Use inventory/group_vars/njalla.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>

Deployment

Run the playbook using the following command,

./bin/apply.sh

Encryption

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>