Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions ct/ansible.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/usr/bin/env bash
_CS_DEFAULT_URL="https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main"
_cs_boot="${COMMUNITY_SCRIPTS_CORE_DIR:-$(dirname "${BASH_SOURCE[0]}")/../../core}/core/build.func"
source "$_cs_boot" 2>/dev/null || source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/core/build.func")

# Copyright (c) 2021-2026 community-scripts ORG
# Author: proxmox-helper
# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE
# Source: https://github.com/ansible/ansible

APP="Ansible"
var_tags="${var_tags:-automation;ansible}"
var_cpu="${var_cpu:-2}"
var_ram="${var_ram:-1024}"
var_disk="${var_disk:-8}"
var_os="${var_os:-debian}"
var_version="${var_version:-13}"
var_unprivileged="${var_unprivileged:-1}"
#var_arm64="${var_arm64:-no}" # unset: this script has not been tested on arm64

header_info "$APP"
variables
color
catch_errors

function update_script() {
header_info
check_container_storage
check_container_resources

if [[ ! -x /opt/ansible/ansible/bin/ansible ]]; then
msg_error "No Ansible Installation Found!"
exit 1
fi

create_backup /etc/ansible /opt/ansible-data
PYTHON_VERSION="3.13" setup_uv

# The community package is published on PyPI; GitHub releases track ansible-core.
msg_info "Updating Ansible"
export UV_TOOL_DIR="/opt/ansible"
export UV_TOOL_BIN_DIR="/usr/local/bin"
$STD uv tool upgrade --python 3.13 ansible
$STD /usr/local/bin/ansible --version
msg_ok "Updated Ansible"

restore_backup
msg_ok "Updated Ansible successfully!"
exit
}

start
build_container
description

msg_ok "Completed Successfully!\n"
echo -e "${CREATING}${GN}Ansible setup has been successfully initialized!${CL}"
echo -e "${INFO}${YW}Open the container console and run: ansible localhost -m ansible.builtin.ping${CL}"
echo -e "${INFO}${YW}Ansible inventory: /etc/ansible/hosts; playbooks: /opt/ansible-data/playbooks${CL}"
56 changes: 56 additions & 0 deletions install/ansible-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/usr/bin/env bash

# Copyright (c) 2021-2026 community-scripts ORG
# Author: proxmox-helper
# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE
# Source: https://github.com/ansible/ansible

source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os

msg_info "Installing Ansible Dependencies"
$STD apt install -y openssh-client git
msg_ok "Installed Ansible Dependencies"

PYTHON_VERSION="3.13" setup_uv

msg_info "Installing Ansible"
export UV_TOOL_DIR="/opt/ansible"
export UV_TOOL_BIN_DIR="/usr/local/bin"
$STD uv tool install --python 3.13 --with-executables-from ansible-core ansible
$STD /usr/local/bin/ansible --version
msg_ok "Installed Ansible"

msg_info "Configuring Ansible"
mkdir -p /etc/ansible /opt/ansible-data/playbooks /opt/ansible-data/roles /opt/ansible-data/collections
chmod 700 /etc/ansible /opt/ansible-data
cat <<'EOF' >/etc/ansible/ansible.cfg
[defaults]
inventory = /etc/ansible/hosts
roles_path = /opt/ansible-data/roles
collections_path = /opt/ansible-data/collections
host_key_checking = True
EOF
cat <<'EOF' >/etc/ansible/hosts
[local]
localhost ansible_connection=local ansible_python_interpreter=/opt/ansible/ansible/bin/python

# Add managed hosts in separate groups, for example:
# [servers]
# server1 ansible_host=192.0.2.10 ansible_user=automation
EOF
chmod 600 /etc/ansible/ansible.cfg /etc/ansible/hosts
msg_ok "Configured Ansible"

msg_info "Verifying Ansible"
$STD /usr/local/bin/ansible localhost -m ansible.builtin.ping
msg_ok "Verified Ansible"

motd_ssh
customize
cleanup_lxc
40 changes: 40 additions & 0 deletions json/ansible.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"name": "Ansible",
"slug": "ansible",
"categories": [19],
"date_created": "2026-10-05",
"type": "ct",
"updateable": true,
"privileged": false,
"interface_port": null,
"documentation": "https://docs.ansible.com/",
"website": "https://www.ansible.com/",
"repository": "https://github.com/ansible/ansible",
"platforms": ["pve"],
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons@main/webp/ansible.webp",
"description": "Ansible automation control node with ansible-core and the community collection bundle, installed in an isolated uv environment.",
"install_methods": [
{
"type": "default",
"script": "ct/ansible.sh",
"config_path": "/etc/ansible/ansible.cfg",
"resources": {
"cpu": 2,
"ram": 1024,
"hdd": 8,
"os": "Debian",
"version": "13"
}
}
],
"default_credentials": {
"username": null,
"password": null
},
"notes": [
{"text": "Command-line control node; use the container console. No web interface or application daemon.", "type": "info"},
{"text": "Inventory is /etc/ansible/hosts. Store playbooks and custom roles or collections in /opt/ansible-data.", "type": "info"},
{"text": "Updates install the latest compatible stable Ansible package from PyPI. Review Ansible porting guides before upgrading.", "type": "info"},
{"text": "Proxmox installation and arm64 support have not yet been tested.", "type": "warning"}
]
}
Loading