英文:
Rundeck import exist ansible project?
问题
有没有一种方法可以集成一个正在运行和运行中的Ansible项目,还是必须从头开始?
我有:
/inventory/hosts.ini
/roles/
role1
...
role 60
/playbook1
/playbook2
ansible.cfg
user:
path_key:
我想在圆角中使用这个。
我已经尝试过使用rd-cli,但我无法真正得到结果。当然,我可以创建一个项目(在一段时间前在网上找到):
# 安装 Rundeck CLI
sudo apt-get install rundeck-cli
# 设置 Rundeck API 密钥
export RD_TOKEN="rundeck-Api-code"
# 设置 Rundeck 服务器 URL
export RD_URL="http://rundeck_server_url:port"
# 设置项目名称
project_name="Your_Project_Name"
# 创建 Rundeck 项目
rd projects create -p $project_name -- \
--project.label="Your Project Label" \
--project.ssh-keypath=/home/rundeck/.ssh/id_rsa
# 配置资源模型源
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 密钥
# 设置 SSH 密钥文件路径
private_key_file_path="/path/to/ssh/key/file"
# 读取 SSH 密钥文件的内容
private_key=$(cat $private_key_file_path)
# 将密钥添加到 Rundeck 密钥存储中
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_name="node1"
node_hostname="node_hostname"
node_username="node_username"
# 添加节点
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
但这对我没有帮助,或者我没有理解。
英文:
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
答案1
得分: 1
你可以集成ansible项目,只需指向项目默认的节点执行器 / 文件复制器的ansible配置和清单文件,以及ansible 模型来源上的适当配置。
现在,要使用你的Ansible Playbooks,请创建指向它们的作业(在作业中添加内联Ansible Playbooks步骤或Ansible Playbook步骤)。
查看这个答案。
英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论