separate yarn and nodejs
This commit is contained in:
		
							parent
							
								
									0cd37bbb07
								
							
						
					
					
						commit
						9670b323c0
					
				@ -2,7 +2,6 @@
 | 
				
			|||||||
- hosts: test
 | 
					- hosts: test
 | 
				
			||||||
  roles:
 | 
					  roles:
 | 
				
			||||||
     - common
 | 
					     - common
 | 
				
			||||||
     - nginx
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # déclaration de la variables globales
 | 
					  # déclaration de la variables globales
 | 
				
			||||||
  vars:
 | 
					  vars:
 | 
				
			||||||
 | 
				
			|||||||
@ -10,6 +10,6 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  # Déclaration des variables globales
 | 
					  # Déclaration des variables globales
 | 
				
			||||||
  vars:
 | 
					  vars:
 | 
				
			||||||
    email: contact@iloth.net
 | 
					    email: contact@bim.land
 | 
				
			||||||
    domain: chat.bim.land
 | 
					    domain: chat.bim.land
 | 
				
			||||||
    cthostname: chat
 | 
					    cthostname: chat
 | 
				
			||||||
 | 
				
			|||||||
@ -1,10 +1,10 @@
 | 
				
			|||||||
---
 | 
					---
 | 
				
			||||||
- hosts: bim
 | 
					- hosts: bim
 | 
				
			||||||
  roles:
 | 
					  roles:
 | 
				
			||||||
    #- common
 | 
					    - common
 | 
				
			||||||
    #- rbenv
 | 
					    - rbenv
 | 
				
			||||||
    #- nginx
 | 
					    - nginx
 | 
				
			||||||
    #- postgresql
 | 
					    - postgresql
 | 
				
			||||||
    - mastodon
 | 
					    - mastodon
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # Déclaration des variables globales
 | 
					  # Déclaration des variables globales
 | 
				
			||||||
@ -15,4 +15,6 @@
 | 
				
			|||||||
    create_user: true
 | 
					    create_user: true
 | 
				
			||||||
    username: mastodon
 | 
					    username: mastodon
 | 
				
			||||||
    installCertbot: true
 | 
					    installCertbot: true
 | 
				
			||||||
 | 
					    debian_version: buster
 | 
				
			||||||
 | 
					    nodejs_version: 12
 | 
				
			||||||
    ruby_version: 2.7.2
 | 
					    ruby_version: 2.7.2
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										0
									
								
								roles/nodejs/README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								roles/nodejs/README.md
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										5
									
								
								roles/nodejs/defaults/main.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								roles/nodejs/defaults/main.yml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,5 @@
 | 
				
			|||||||
 | 
					requiredPackages:
 | 
				
			||||||
 | 
					  - apt-transport-https
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					nodejs_version: 12
 | 
				
			||||||
 | 
					debian_version: buster
 | 
				
			||||||
							
								
								
									
										14
									
								
								roles/nodejs/tasks/main.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								roles/nodejs/tasks/main.yml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,14 @@
 | 
				
			|||||||
 | 
					- name: Add Nodejs apt key
 | 
				
			||||||
 | 
					  apt_key:
 | 
				
			||||||
 | 
					    url: https://deb.nodesource.com/gpgkey/nodesource.gpg.key
 | 
				
			||||||
 | 
					    state: present
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- name: Add Nodes 12 repository
 | 
				
			||||||
 | 
					  apt_repository:
 | 
				
			||||||
 | 
					    repo: deb https://deb.nodesource.com/node_"{{ nodejs_version }}".x "{{ debian_version }}" main
 | 
				
			||||||
 | 
					    state: present
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- name: Install NodeJs
 | 
				
			||||||
 | 
					  apt:
 | 
				
			||||||
 | 
					    name: nodejs
 | 
				
			||||||
 | 
					    state: present
 | 
				
			||||||
@ -1,121 +0,0 @@
 | 
				
			|||||||
#!/bin/bash
 | 
					 | 
				
			||||||
set -e
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
homebrew=
 | 
					 | 
				
			||||||
type -p brew >/dev/null && homebrew=1
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
try_bash_extension() {
 | 
					 | 
				
			||||||
  if [ -x src/configure ]; then
 | 
					 | 
				
			||||||
    src/configure && make -C src || {
 | 
					 | 
				
			||||||
      echo "Optional bash extension failed to build, but things will still work normally."
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  fi
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
if ! type -p git >/dev/null; then
 | 
					 | 
				
			||||||
  git() {
 | 
					 | 
				
			||||||
    echo "Error: git is required to proceed. Please install git and try again." >&2
 | 
					 | 
				
			||||||
    exit 1
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
fi
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
http() {
 | 
					 | 
				
			||||||
  local url="$1"
 | 
					 | 
				
			||||||
  if type -p curl >/dev/null; then
 | 
					 | 
				
			||||||
    curl -fsSL "$url"
 | 
					 | 
				
			||||||
  elif type -p wget >/dev/null; then
 | 
					 | 
				
			||||||
    wget -q "$url" -O-
 | 
					 | 
				
			||||||
  else
 | 
					 | 
				
			||||||
    echo "Error: couldn't download file. No \`curl' or \`wget' found." >&2
 | 
					 | 
				
			||||||
    return 1
 | 
					 | 
				
			||||||
  fi
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
rbenv="$(command -v rbenv ~/.rbenv/bin/rbenv | head -1)"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
if [ -n "$rbenv" ]; then
 | 
					 | 
				
			||||||
  echo "rbenv already seems installed in \`$rbenv'."
 | 
					 | 
				
			||||||
  cd "${rbenv%/*}"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  if [ -x ./brew ]; then
 | 
					 | 
				
			||||||
    echo "Trying to update with Homebrew..."
 | 
					 | 
				
			||||||
    brew update >/dev/null
 | 
					 | 
				
			||||||
    if [ "$(./rbenv --version)" < "1.0.0" ] && brew list rbenv | grep -q rbenv/HEAD; then
 | 
					 | 
				
			||||||
      brew uninstall rbenv
 | 
					 | 
				
			||||||
      brew install rbenv --without-ruby-build
 | 
					 | 
				
			||||||
    else
 | 
					 | 
				
			||||||
      brew upgrade rbenv
 | 
					 | 
				
			||||||
    fi
 | 
					 | 
				
			||||||
  elif git remote -v 2>/dev/null | grep -q rbenv; then
 | 
					 | 
				
			||||||
    echo "Trying to update with git..."
 | 
					 | 
				
			||||||
    git pull --tags origin master
 | 
					 | 
				
			||||||
    cd ..
 | 
					 | 
				
			||||||
    try_bash_extension
 | 
					 | 
				
			||||||
  fi
 | 
					 | 
				
			||||||
else
 | 
					 | 
				
			||||||
  if [ -n "$homebrew" ]; then
 | 
					 | 
				
			||||||
    echo "Installing rbenv with Homebrew..."
 | 
					 | 
				
			||||||
    brew update
 | 
					 | 
				
			||||||
    brew install rbenv --without-ruby-build
 | 
					 | 
				
			||||||
    rbenv="$(brew --prefix)/bin/rbenv"
 | 
					 | 
				
			||||||
  else
 | 
					 | 
				
			||||||
    echo "Installing rbenv with git..."
 | 
					 | 
				
			||||||
    mkdir -p ~/.rbenv
 | 
					 | 
				
			||||||
    cd ~/.rbenv
 | 
					 | 
				
			||||||
    git init
 | 
					 | 
				
			||||||
    git remote add -f -t master origin https://github.com/rbenv/rbenv.git
 | 
					 | 
				
			||||||
    git checkout -b master origin/master
 | 
					 | 
				
			||||||
    try_bash_extension
 | 
					 | 
				
			||||||
    rbenv=~/.rbenv/bin/rbenv
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if [ ! -e versions ] && [ -w /opt/rubies ]; then
 | 
					 | 
				
			||||||
      ln -s /opt/rubies versions
 | 
					 | 
				
			||||||
    fi
 | 
					 | 
				
			||||||
  fi
 | 
					 | 
				
			||||||
fi
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
rbenv_root="$("$rbenv" root)"
 | 
					 | 
				
			||||||
ruby_build="$(command -v "$rbenv_root"/plugins/*/bin/rbenv-install rbenv-install | head -1)"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
echo
 | 
					 | 
				
			||||||
if [ -n "$ruby_build" ]; then
 | 
					 | 
				
			||||||
  echo "\`rbenv install' command already available in \`$ruby_build'."
 | 
					 | 
				
			||||||
  cd "${ruby_build%/*}"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  if [ -x ./brew ]; then
 | 
					 | 
				
			||||||
    echo "Trying to update with Homebrew..."
 | 
					 | 
				
			||||||
    brew update >/dev/null
 | 
					 | 
				
			||||||
    brew upgrade ruby-build
 | 
					 | 
				
			||||||
  elif git remote -v 2>/dev/null | grep -q ruby-build; then
 | 
					 | 
				
			||||||
    echo "Trying to update with git..."
 | 
					 | 
				
			||||||
    git pull origin master
 | 
					 | 
				
			||||||
  fi
 | 
					 | 
				
			||||||
else
 | 
					 | 
				
			||||||
  if [ -n "$homebrew" ]; then
 | 
					 | 
				
			||||||
    echo "Installing ruby-build with Homebrew..."
 | 
					 | 
				
			||||||
    brew update
 | 
					 | 
				
			||||||
    brew install ruby-build
 | 
					 | 
				
			||||||
  else
 | 
					 | 
				
			||||||
    echo "Installing ruby-build with git..."
 | 
					 | 
				
			||||||
    mkdir -p "${rbenv_root}/plugins"
 | 
					 | 
				
			||||||
    git clone https://github.com/rbenv/ruby-build.git "${rbenv_root}/plugins/ruby-build"
 | 
					 | 
				
			||||||
  fi
 | 
					 | 
				
			||||||
fi
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Enable caching of rbenv-install downloads
 | 
					 | 
				
			||||||
mkdir -p "${rbenv_root}/cache"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
echo
 | 
					 | 
				
			||||||
echo "Running doctor script to verify installation..."
 | 
					 | 
				
			||||||
http https://github.com/rbenv/rbenv-installer/raw/master/bin/rbenv-doctor | "$BASH"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
echo
 | 
					 | 
				
			||||||
echo "All done!"
 | 
					 | 
				
			||||||
echo "Note that this installer doesn't yet configure your shell startup files:"
 | 
					 | 
				
			||||||
i=0
 | 
					 | 
				
			||||||
if [ -x ~/.rbenv/bin ]; then
 | 
					 | 
				
			||||||
  echo "$((++i)). You'll want to ensure that \`~/.rbenv/bin' is added to PATH."
 | 
					 | 
				
			||||||
fi
 | 
					 | 
				
			||||||
echo "$((++i)). Run \`rbenv init' to see instructions how to configure rbenv for your shell."
 | 
					 | 
				
			||||||
echo "$((++i)). Launch a new terminal window to verify that the configuration is correct."
 | 
					 | 
				
			||||||
echo
 | 
					 | 
				
			||||||
							
								
								
									
										0
									
								
								roles/yarn/README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								roles/yarn/README.md
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										17
									
								
								roles/yarn/tasks/main.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								roles/yarn/tasks/main.yml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,17 @@
 | 
				
			|||||||
 | 
					---
 | 
				
			||||||
 | 
					---
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- name: Add Yarn apt key
 | 
				
			||||||
 | 
					  apt_key:
 | 
				
			||||||
 | 
					    url: https://dl.yarnpkg.com/debian/pubkey.gpg
 | 
				
			||||||
 | 
					    state: present
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- name: Add Yarn Repository
 | 
				
			||||||
 | 
					  apt_repository:
 | 
				
			||||||
 | 
					    repo: deb https://dl.yarnpkg.com/debian/ stable main
 | 
				
			||||||
 | 
					    state: present
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- name: Install Yarn
 | 
				
			||||||
 | 
					  apt:
 | 
				
			||||||
 | 
					    name: yarn
 | 
				
			||||||
 | 
					    state: present
 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user