Skip to content

fix: use && execute ansible shell#16

Open
vpc123 wants to merge 5 commits into
KubeOperator:masterfrom
vpc123:master
Open

fix: use && execute ansible shell#16
vpc123 wants to merge 5 commits into
KubeOperator:masterfrom
vpc123:master

Conversation

@vpc123

@vpc123 vpc123 commented Dec 18, 2022

Copy link
Copy Markdown
Contributor

shell: "sudo mv -f /etc/yum.repos.d/.repo /etc/yum.repos.d/bak >/dev/null 2>&1 || sudo ls /etc/yum.repos.d/ >/dev/null 2>&1 || yum clean all >/dev/null 2>&1 || rm -rf /var/cache/yum/ 2>&1"

ansible shell if use || , subsequent commands will not be executed,so before commands will not executed yum clean all && rm -rf /var/cache/yum/* ;

The best way is through && join this commands and end with || sudo ls /etc/yum.repos.d/ >/dev/null 2>&1;

for example:
shell: "sudo mv -f /etc/yum.repos.d/.repo /etc/yum.repos.d/bak >/dev/null 2>&1 && yum clean all >/dev/null 2>&1 && rm -rf /var/cache/yum/ 2>&1 || sudo ls /etc/yum.repos.d/ >/dev/null 2>&1"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant