From 738e88dcfd8e6a6fd5bc44ac3f611a2058b3ab41 Mon Sep 17 00:00:00 2001 From: Marc Gariepy Date: Thu, 15 Sep 2016 09:08:23 -0400 Subject: [PATCH] Remove requiretty for sudo on centos hosts. 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: Ifbba7153cf7d3d97daf86106c1f027787d76e865 --- tasks/openstack_host_install_yum.yml | 10 ++++++++++ templates/sudoers.j2 | 2 ++ 2 files changed, 12 insertions(+) create mode 100644 templates/sudoers.j2 diff --git a/tasks/openstack_host_install_yum.yml b/tasks/openstack_host_install_yum.yml index a399a005..a3185272 100644 --- a/tasks/openstack_host_install_yum.yml +++ b/tasks/openstack_host_install_yum.yml @@ -25,3 +25,13 @@ tags: - openstack-yum-packages - openstack-packages + +- name: Disable requiretty for root sudo on centos + template: + dest: /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