Skip to content

k3karthic/ansible__totp-generator-ipfs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ansible — Deploy TOTP Generator to IPFS

This playbook creates a bash script which can,

Demo,

Assumption: The instance runs in Oracle Cloud using the Terraform script below,

bin/deploy.sh uses an Ansible ad-hoc task to run publish_totp_ipfs.sh on the instance.

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.

The target Ubuntu instance must have the freeform tag ipfs_service: yes.

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/

IPNS Initialization

IPNS derives the public URL from a keypair. Follow the instructions below to create a keypair.

Create a key using the following command and note the ID in the result,

$ ipfs key gen <name>

Export the key using the following command,

$ ipfs key export <name>
  1. Save the ID and name in inventory/group_vars/tag_ipfs_service=yes.yml. Use inventory/group_vars/tag_ipfs_service=yes.yml.sample as a reference.
  2. Save the exported key in the files directory.

Deployment

Run the playbook using the following command,

$ ./bin/apply.sh

Encryption

Encrypt sensitive files (IPFS key, SSH private keys and inventory/group_vars/tag_ipfs_service=yes.yml) 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>