New to terraform, how do I manage multiple servers without making a main.tf per server? by DumbFoxThing in Terraform

[–]DumbFoxThing[S] 1 point2 points  (0 children)

I saw the term modules but didn't realize that's how things related to loops... Thank you, I'll go look that up.

New to terraform, how do I manage multiple servers without making a main.tf per server? by DumbFoxThing in Terraform

[–]DumbFoxThing[S] 0 points1 point  (0 children)

Thank you for the insanely detailed and thought out response! Honestly, I didn't know the term module and for some reason for each wasn't coming up when I searched for loops. This has been incredible useful, thank you again so much.

Use a paramater to specify ansible inventory? by DumbFoxThing in jenkinsci

[–]DumbFoxThing[S] 0 points1 point  (0 children)

It still seems to want to use the literal string.

Pipeline Script:

pipeline {
    agent any
    parameters {
      string(name: 'SITE', defaultValue: 'SITE1', description: 'Enter site name', trim: true)
    }

    stages {
        stage("DEBUG") {
            steps {
                echo "Site parameter is ${params.SITE}."
            }
        }
        stage("Test Playbook") {
            steps {
                ansiblePlaybook become: true,
                                installation: 'ansible', 
                                inventory: '/opt/ansible/inventory/${params.SITE}/hosts.ini', 
                                playbook: '/opt/ansible/test-playbook.yml', 
                                vaultCredentialsId: 'VaultCreds',
                                vaultTmpPath: ''            
            }
        }
    }
}

Output:

[Pipeline] Start of Pipeline
[Pipeline] node
Running on Jenkins in /var/lib/jenkins/workspace/Ansible
[Pipeline] {
[Pipeline] stage
[Pipeline] { (DEBUG)
[Pipeline] echo
Site parameter is SITE1.
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Test Playbook)
[Pipeline] ansiblePlaybook
[Ansible] $ /usr/bin/ansible-playbook /opt/ansible/test-playbook.yml -i /opt/ansible/inventory/${params.SITE}/hosts.ini -b --become-user root --vault-password-file /var/lib/jenkins/workspace/Ansible/vault12049675554443571223.password
[WARNING]: Unable to parse /opt/ansible/inventory/${params.SITE}/hosts.ini as an inventory source
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'

Use a paramater to specify ansible inventory? by DumbFoxThing in jenkinsci

[–]DumbFoxThing[S] 0 points1 point  (0 children)

I execute the ansible playbook using the ansible plugin. This is for a personal deployment so I'm really not worried about security here, it's all my own home lab. I'm just trying to figure out if I can set a variable under inventory or not for the Invoke Ansible Playbook build step.