Skip to content

Commit

Permalink
ansibleplaybook-ssh-become-root-with-password: enable choose ansible-…
Browse files Browse the repository at this point in the history
…core version
  • Loading branch information
apenella committed Sep 25, 2024
1 parent fe24043 commit bd89f78
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 16 deletions.
3 changes: 2 additions & 1 deletion examples/ansibleplaybook-ssh-become-root-with-password/.env
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
GOLANG_VERSION=1.22
GOLANG_VERSION=1.22
ANSIBLE_CORE_VERSION=2.16.9
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,6 @@ func main() {
playbook.WithPlaybookOptions(ansiblePlaybookOptions),
)

// exec := stdoutcallback.NewYAMLStdoutCallbackExecute(

// )

// exec := configuration.NewAnsibleWithConfigurationSettingsExecute(
// execute.NewDefaultExecute(
// execute.WithCmd(cmd),
// execute.WithErrorEnrich(playbook.NewAnsiblePlaybookErrorEnrich()),
// ),
// configuration.WithAnsibleForceColor(),
// ),

exec := configuration.NewAnsibleWithConfigurationSettingsExecute(
execute.NewDefaultExecute(
execute.WithCmd(cmd),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ services:
context: docker/ansible
args:
- golang_version=${GOLANG_VERSION}
- ansible_core_version=${ANSIBLE_CORE_VERSION}
command: ["tail", "-f", "/dev/null"]
# command: ["ansible-playbook", "--help"]
volumes:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ FROM golang:${golang_version}-bookworm as golang

FROM python:3.12-alpine3.19

ARG ansible_core_version=2.16.9

RUN apk add --update --no-cache \
openssh-client \
git \
Expand All @@ -15,8 +17,10 @@ RUN pip3 install -U pip setuptools \
cryptography \
# Required library to execute ansible community.general.dig plugin
dnspython \
ansible \
&& ln /usr/local/bin/ansible-playbook /usr/bin/ansible-playbook
# ansible \
ansible-core==${ansible_core_version} \
&& ln /usr/local/bin/ansible-playbook /usr/bin/ansible-playbook \
&& ansible-galaxy collection install community.general

COPY --from=golang /usr/local/go /usr/local/go

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
- name: ansibleplaybook-ssh
ansible.builtin.debug:
msg: |
Your are running 'ansibleplaybook-ssh-sudo' example
Your are running 'ansibleplaybook-ssh-become-root-with-password' example
Remote server IP is: {{ hostvars['server']['ansible_facts']['eth0']['ipv4']['address'] }}
Expand Down

0 comments on commit bd89f78

Please sign in to comment.