FAQ
Hey Daniel, thanks very much. Explains a lot.
On Tuesday, July 8, 2014 5:02:56 PM UTC-7, Daniel Jagszent wrote:

Hi Justin,

looks like you did not got the requisite reference of e.g. the
"get-composer" state right.

http://docs.saltstack.com/en/latest/ref/states/highstate.html#requisite-reference

It is "pkg: the id of the state" not "pkg: the name of the package in the
apt repository"

get-composer:
cmd.run:
- name: curl -sS https://getcomposer.org/installer | php
- unless: test -f /usr/local/bin/composer
- cwd: /root/
- require:
- pkg: utils
- pkg: php5

# you need to have a "php5" id declaration somewhere with a
"pkg.installed" state declaration
# something like
php5:
pkg.installed:
- name: php5-fpm


Bonus tip: If you install multiple pakages in one id declaration, you
should use "pkgs" instead of "names". That is far quicker as explained here:

http://docs.saltstack.com/en/latest/ref/states/all/salt.states.pkg.html#salt.states.pkg.installed
(warning box for names parameter)
utils:
pkg.installed:
- pkgs:
- vim
- htop
- screen
- curl



Justin Vincent wrote:

Pulling hair out here!

For some reason salt won't try ti install composer because it says that
curl and php5 requirements are not being met... yet when I
use pkg.list_pkgs they are on the machine.

All help much appreciated!

*Salt state file...*

# ~~~
# Installs utilities

utils:
pkg:
- installed
- names:
- vim
- htop
- screen
- curl

# ~~~
# Installs and watches composer

get-composer:
cmd.run:
- name: curl -sS https://getcomposer.org/installer | php
- unless: test -f /usr/local/bin/composer
- cwd: /root/
- require:
- pkg: curl
- pkg: php5

install-composer:
cmd.wait:
- name: mv /root/composer.phar /usr/local/bin/composer
- cwd: /root/
- watch:
- cmd: get-composer

/var/www/api:
composer.installed:
- no_dev: true
- require:
- cmd: install-composer

*Salt master output...*

cloud-local-justin:
----------
ID: get-composer
Function: cmd.run
Name: curl -sS https://getcomposer.org/installer | php
Result: False
Comment: The following requisites were not found:
require:
pkg: php5
Changes:
----------
ID: utils
Function: pkg.installed
Name: screen
Result: True
Comment: Package screen is already installed
Changes:
----------
ID: install-composer
Function: cmd.wait
Name: mv /root/composer.phar /usr/local/bin/composer
Result: False
Comment: One or more requisite failed
Changes:
----------
ID: utils
Function: pkg.installed
Name: htop
Result: True
Comment: Package htop is already installed
Changes:
----------
ID: /var/www/api
Function: composer.installed
Result: False
Comment: One or more requisite failed
Changes:
----------
ID: utils
Function: pkg.installed
Name: curl
Result: True
Comment: Package curl is already installed
Changes:
----------
ID: utils
Function: pkg.installed
Name: vim
Result: True
Comment: Package vim is already installed
Changes:

Summary
------------
Succeeded: 4
Failed: 3
------------
Total: 7

*BUT the pkgs ARE installed...*

salt "cloud-local-justin" pkg.list_pkgs

curl:

7.22.0-3ubuntu4.8

curl-ssl:

1

php5:

5.3.10-1ubuntu3.12

php5-cli:

5.3.10-1ubuntu3.12

php5-common:

5.3.10-1ubuntu3.12

php5-curl:

5.3.10-1ubuntu3.12

php5-fpm:

5.3.10-1ubuntu3.12

php5-gd:

5.3.10-1ubuntu3.12

php5-imagick:

3.1.0~rc1-1

php5-json:

1

php5-mcrypt:

5.3.5-0ubuntu1

php5-mhash:

1

php5-mysql:

5.3.10-1ubuntu3.12

php5-xmlrpc:

5.3.10-1ubuntu3.12

--
You received this message because you are subscribed to the Google Groups
"Salt-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to salt-users+...@googlegroups.com <javascript:>.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Salt-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Discussion Posts

Previous

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 6 of 6 | next ›
Discussion Overview
groupsalt-users @
postedJul 8, '14 at 5:42p
activeJul 9, '14 at 12:41a
posts6
users4

People

Translate

site design / logo © 2022 Grokbase