Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
configuration
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
configuration
Commits
0af94d10
Commit
0af94d10
authored
Nov 07, 2013
by
John Jarvis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
moving hostname logic to the common role
parent
3038bb94
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
99 additions
and
20 deletions
+99
-20
playbooks/roles/common/defaults/main.yml
+4
-1
playbooks/roles/common/tasks/main.yml
+18
-0
playbooks/roles/common/templates/bash.bashrc.j2
+76
-0
playbooks/roles/common/templates/hostname.j2
+0
-0
playbooks/roles/common/templates/hosts.j2
+0
-0
playbooks/roles/common/templates/motd.tail.j2
+1
-0
playbooks/roles/hostname/defaults/main.yml
+0
-2
playbooks/roles/hostname/tasks/main.yml
+0
-17
No files found.
playbooks/roles/common/defaults/main.yml
View file @
0af94d10
...
...
@@ -18,7 +18,10 @@ COMMON_ENV_TYPE: 'default_type'
COMMON_PYPI_MIRROR_URL
:
'
https://pypi.python.org/simple'
# do not include http/https
COMMON_GIT_MIRROR
:
'
github.com'
# override this var to set a different hostname
COMMON_HOSTNAME
:
!!null
# override this var to add a prefix to the prompt
COMMON_PROMPT
:
"
"
common_debian_pkgs
:
...
...
playbooks/roles/common/tasks/main.yml
View file @
0af94d10
...
...
@@ -45,3 +45,21 @@
-
name
:
common | Install logrotate configuration for edX
template
:
dest=/etc/logrotate.d/edx-services src=edx_logrotate.j2 owner=root group=root mode=644
-
name
:
common | update /etc/hosts
template
:
src=hosts.j2 dest=/etc/hosts
when
:
common_hostname
register
:
etc_hosts
-
name
:
common | update /etc/hostname
template
:
src=hostname.j2 dest=/etc/hostname
when
:
common_hostname
register
:
etc_hostname
-
name
:
common | run hostname
shell
:
>
hostname -F /etc/hostname
when
:
common_hostname and (etc_hosts.changed or etc_hostname.changed)
-
name
:
common | set global bashrc
template
:
src=bash.bashrc.j2 dest=/etc/bash.bashrc
playbooks/roles/common/templates/bash.bashrc.j2
0 → 100644
View file @
0af94d10
# {{ ansible_managed }}
# System-wide .bashrc file for interactive bash(1) shells.
# To enable the settings / commands in this file for login shells as well,
# this file has to be sourced in /etc/profile.
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
# set a fancy prompt (non-color, overwrite the one in /etc/profile)
PS1='{{ hostname_prompt }}${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
# enable bash completion in interactive shells
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
. /etc/bash_completion
fi
# keep a full history log
if [ "$BASH_VERSINFO" -ge 2 ]; then
shopt -s cdspell
shopt -s checkwinsize
shopt -s cmdhist
shopt -s histappend
shopt -s checkhash
shopt -s no_empty_cmd_completion
shopt -s execfail
HISTFILESIZE=10000
HISTDIR="$HOME/.bash_histories/`uname -n`"
[[ ! -d $HISTDIR ]] && mkdir -p "$HISTDIR"
HISTFILE="$HISTDIR/`date +%Y_%m`"
# Suppress duplicates, bare "ls" and bg,fg and exit
HISTIGNORE="&:ls:[bf]g:exit"
fi
# sudo hint
if [ ! -e "$HOME/.sudo_as_admin_successful" ] && [ ! -e "$HOME/.hushlogin" ] ; then
case " $(groups) " in *\ admin\ *)
if [ -x /usr/bin/sudo ]; then
cat <<-EOF
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
EOF
fi
esac
fi
# if the command-not-found package is installed, use it
if [ -x /usr/lib/command-not-found -o -x /usr/share/command-not-found/command-not-found ]; then
function command_not_found_handle {
# check because c-n-f could've been removed in the meantime
if [ -x /usr/lib/command-not-found ]; then
/usr/bin/python /usr/lib/command-not-found -- "$1"
return $?
elif [ -x /usr/share/command-not-found/command-not-found ]; then
/usr/bin/python /usr/share/command-not-found/command-not-found -- "$1"
return $?
else
printf "%s: command not found\n" "$1" >&2
return 127
fi
}
fi
playbooks/roles/
hostname
/templates/hostname.j2
→
playbooks/roles/
common
/templates/hostname.j2
View file @
0af94d10
File moved
playbooks/roles/
hostname
/templates/hosts.j2
→
playbooks/roles/
common
/templates/hosts.j2
View file @
0af94d10
File moved
playbooks/roles/common/templates/motd.tail.j2
0 → 100644
View file @
0af94d10
# Welcome to the edX server
playbooks/roles/hostname/defaults/main.yml
deleted
100644 → 0
View file @
3038bb94
---
hostname
:
edx-server
playbooks/roles/hostname/tasks/main.yml
deleted
100644 → 0
View file @
3038bb94
---
# Simple role to change a hostname on an ubuntu server
-
name
:
hostname | update /etc/hosts
template
:
src=hosts.j2 dest=/etc/hosts
register
:
etc_hosts
-
name
:
hostname | update /etc/hostname
template
:
src=hostname.j2 dest=/etc/hostname
register
:
etc_hostname
-
name
:
hostname | run hostname
shell
:
>
hostname -F /etc/hostname
when
:
etc_hosts.changed or etc_hostname.changed
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment