From cf65c6736bccae88511b11a3ae85bcc82cd3b322 Mon Sep 17 00:00:00 2001 From: Marc Gariepy Date: Thu, 15 Sep 2016 08:55:29 -0400 Subject: [PATCH] Remove requiretty for sudo on centos base image. In order to be able to use become: yes to execute command with ansible the requiretty option needs to be disabled on centos Change-Id: Iab2408267fdcb1c19c3c560d2f86181a6fc180e0 --- tasks/lxc_cache_preparation.yml | 10 ++++++++++ templates/sudoers.j2 | 2 ++ 2 files changed, 12 insertions(+) create mode 100644 templates/sudoers.j2 diff --git a/tasks/lxc_cache_preparation.yml b/tasks/lxc_cache_preparation.yml index 44c3add8..5973a8d0 100644 --- a/tasks/lxc_cache_preparation.yml +++ b/tasks/lxc_cache_preparation.yml @@ -106,3 +106,13 @@ tags: - lxc-cache - lxc-cache-apt-keys + +- name: Remove requiretty for sudo on centoos + template: + dest: "/var/lib/lxc/LXC_NAME/rootfs/etc/sudoers.d/openstack-ansible" + owner: root + group: root + mode: "0440" + src: sudoers.j2 + when: + - ansible_pkg_mgr == 'yum' diff --git a/templates/sudoers.j2 b/templates/sudoers.j2 new file mode 100644 index 00000000..a3ea93d1 --- /dev/null +++ b/templates/sudoers.j2 @@ -0,0 +1,2 @@ +# {{ ansible_managed }} +Defaults:root !requiretty