Compare commits

..

5 Commits

Author SHA1 Message Date
renovate-bot
765c313800 ⬆️ Update dependency ansible to v5.5.0
All checks were successful
continuous-integration/drone/push Build is passing
2022-03-16 02:03:54 +00:00
428c048152 Update 'entrypoint'
Some checks reported errors
continuous-integration/drone/push Build was killed
continuous-integration/drone Build is passing
2022-03-12 23:54:05 +01:00
701d3715ac
🔨 remove double quote
Some checks reported errors
continuous-integration/drone/push Build was killed
continuous-integration/drone Build is passing
2022-03-04 16:19:53 +01:00
8cfae7c22a
🔨 Try with args as list
Some checks reported errors
continuous-integration/drone/push Build was killed
continuous-integration/drone Build is passing
2022-03-04 15:37:11 +01:00
c85bcb9d44
🔨 Add tags
Some checks reported errors
continuous-integration/drone/push Build was killed
continuous-integration/drone Build is passing
2022-02-28 11:27:38 +01:00
3 changed files with 18 additions and 10 deletions

View File

@ -4,7 +4,7 @@ RUN apt-get update && apt-get install -y git \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
# renovate: datasource=pypi depName=ansible # renovate: datasource=pypi depName=ansible
ENV ANSIBLE_VERSION=5.4.0 ENV ANSIBLE_VERSION=5.5.0
RUN pip3 install --no-cache-dir ansible==${ANSIBLE_VERSION} dnspython RUN pip3 install --no-cache-dir ansible==${ANSIBLE_VERSION} dnspython
COPY entrypoint /bin/entrypoint COPY entrypoint /bin/entrypoint

View File

@ -24,7 +24,9 @@ steps:
- name: Run ansible playbook - name: Run ansible playbook
image: harbor.sebclem.fr/sebclem/drone-ansible-runner image: harbor.sebclem.fr/sebclem/drone-ansible-runner
settings: settings:
verbosity: 1 verbosity: ${verbosity=1}
limit: ${limit}
tags: ${tags}
playbook: sites.yml playbook: sites.yml
galaxy_file: roles/requirements.yml galaxy_file: roles/requirements.yml
check_syntax: true check_syntax: true

View File

@ -17,19 +17,19 @@ fi
if [[ -z "$PLUGIN_PRIVATE_KEY" ]]; then if [[ -z "$PLUGIN_PRIVATE_KEY" ]]; then
echo -e "\e[31m[WARN] 'private_key' setting not defined !\e[39m" echo -e "\e[31m[WARN] 'private_key' setting not defined !\e[39m"
else else
run_command "mkdir /root/.ssh" run_command "mkdir /root/.ssh"
echo "$PLUGIN_PRIVATE_KEY" > /root/.ssh/id_ed25519 echo "$PLUGIN_PRIVATE_KEY" > /root/.ssh/id_ed25519
run_command chmod 400 /root/.ssh/id_ed25519 run_command chmod 400 /root/.ssh/id_ed25519
fi fi
args="$PLUGIN_PLAYBOOK" args=("$PLUGIN_PLAYBOOK")
if [[ -n "$PLUGIN_VAULT_TOKEN" ]]; then if [[ -n "$PLUGIN_VAULT_TOKEN" ]]; then
echo "Adding vault token to 'credentials/vault_token'" echo "Adding vault token to 'credentials/vault_token'"
run_command "mkdir credentials" run_command "mkdir credentials"
echo "$PLUGIN_VAULT_TOKEN" > credentials/vault_token echo "$PLUGIN_VAULT_TOKEN" > credentials/vault_token
args="$args --vault-password-file credentials/vault_token" args+=("--vault-password-file" "credentials/vault_token")
echo "" echo ""
fi fi
@ -45,19 +45,25 @@ if [[ -n "$PLUGIN_GALAXY_FILE" ]]; then
fi fi
if [[ $check = true ]]; then if [[ $check = true ]]; then
args="$args --syntax-check" args+=("--syntax-check")
fi fi
if [[ $verbosity != "0" ]]; then if [[ $verbosity != "0" ]]; then
args="${args} -" verb="-"
for i in `seq 1 $verbosity`; do for i in `seq 1 $verbosity`; do
args="${args}v" verb+="v"
done done
args+=("$verb")
fi fi
if [[ -n "$PLUGIN_LIMIT" ]]; then if [[ -n "$PLUGIN_LIMIT" ]]; then
args="${args} --limit \"$PLUGIN_LIMIT\"" args+=("--limit" "$PLUGIN_LIMIT")
fi
if [[ -n "$PLUGIN_TAGS" ]]; then
args+=("--tags" "$PLUGIN_TAGS")
fi fi
run_command "export ANSIBLE_HOST_KEY_CHECKING=False" run_command "export ANSIBLE_HOST_KEY_CHECKING=False"
run_command "ansible-playbook $args" echo "ansible-playbook ${args[@]}"
ansible-playbook "${args[@]}"