Search code examples
linuxansibleconfigpatchrundeck

Rundeck import exist ansible project?


Is there a way to integrate a running and functioning Ansible project or do you have to start from scratch?

I have: /inventory/hosts.ini /roles/ role1 ... role 60

/playbook1 /playbook2

ansible.cfg user: path_key:

and i would like to use this in round corner.

I have already tried to work with the rd-cli but I can't really get a result. Sure, I can create a project (found it on www a while ago):

# Rundeck CLI installieren
sudo apt-get install rundeck-cli

# Rundeck API Key setzen
export RD_TOKEN="rundeck-Api-code"

# Rundeck Server URL setzen
export RD_URL="http://rundeck_server_url:port"

# Projektname festlegen
project_name="Ihr_Projektname"

# Rundeck Projekt erstellen
rd projects create -p $project_name -- \
    --project.label="Ihr Projekt Label" \
    --project.ssh-keypath=/home/rundeck/.ssh/id_rsa

# Ressourcenmodellquelle festlegen
rd projects configure update -p $project_name -- \
    --resources.source.1.type=url \
    --resources.source.1.config.url=/home/rundeck/projects/$project_name/resources.d

# SSH Schlüssel hinzufügen
# Setzen Sie den Pfad zur SSH-Schlüsseldatei
private_key_file_path="/pfad/zur/ssh/schlüsseldatei"

# Lesen Sie den Inhalt der SSH-Schlüsseldatei
private_key=$(cat $private_key_file_path)

# Fügen Sie den Schlüssel in den Rundeck Key Storage ein
curl -H "X-Rundeck-Auth-Token: $RD_TOKEN" -X POST --data "$private_key" \
     -H "Content-Type: application/octet-stream" \
     $RD_URL/api/27/storage/keys/rundeck

# Node hinzufügen
# Node Informationen setzen
node_name="node1"
node_hostname="hostname_des_nodes"
node_username="benutzername_des_nodes"

# Node hinzufügen
cat > /home/rundeck/projects/$project_name/resources.d/$node_name.yaml << EOL
$node_name:
  nodename: $node_name
  hostname: $node_hostname
  description: ''
  username: $node_username
  osFamily: unix
  ssh-key-storage-path: keys/rundeck
EOL

but that does not help me or i didnt understood


Solution

  • You can integrate ansible projects, just point the ansible config and inventory file on the project default node executor / file copier and the proper config on the ansible model source.

    Now, to use your Ansible playbooks, create jobs that point to them (adding a inline ansible playbooks steps or ansible playbook steps on the job).

    Check this answer.